set legend in a for loop plot from a cell in matlab plot -


I need your help to solve a problem when I try to create a legend for the loop plot I am here. I am using the following code

  i = 3: 14 plot (data (,, i), data (:, 2)); Grab all; And Legend (textData {1,3: 14});   

Texdata is a 1x14 cell where they are stored in the names of the legends I want to use. When I'm running my script, I get a plot but instead of legend I get this error message "??? Index matrix is ​​more than dimensions"

Edit: I reply to whos textdata , because I can not write it on the comment reply well

  & gt; & Gt; Whos textdata name size byte class property textdata 1x14 1652 cell    

This works fine for me This code text string should not have any difference in the length of each string.

  data = magic (14); Data (2, :) = 1: 10: 140; Textdata = {'A' B '' C '' 'D' 'E' '' F '' '' '' '' '' '' '' '' '' '' '' '; For I = 3: 14 plot (data (,, i), data (:, 2)); Grab all; And Legend (textData {1,3: 14});   

If you get an error other than the legend, then it is known that this is a problem with text data. Your plot works fine, though I think? Are you sure your text data is properly stored? It is likely that the plot which you are trying to plot is good, the textadata in different dimensions is good.

Try to run whatever you say, like this comment:

  & gt; & Gt; Edit: Comments were updated when I wrote a reply ...   

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -