I have a loop which processes three tables. Each table has ten columns (in addition, each column includes column names). When I plot the three figures in the loop, I want to include legends which state the column name of each variable within the plot. I know how to make this manually by typing the legends in the Matlab code. However, since the column names are changing depending on table I want to perform this automatically in the script. My though is to use "Display" but I do not know how to apply this kind of approach. In terms of code procedure, I thought something similar to this (not working unfortunately):
I'm working with another example in which I want to implement my code. However, it is a bit more complex than your example. I have a table with 12 columns. Each column has a unique id namn consisting of both numbers and characters. II have a loop where I'm plotting this data where three of the columns are plotted in the same plot which gives 4 plots. I want to include legends based on the variable names (uniques id:s). I have problems creating this. I get the first three variables names as legends in each loop. Do you have any idea to solve this?
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.