title: set legend in a for loop plot from a cell in matlab plot
body: <p>I need your help to solve a problem i am facing when i am trying to create a legend to a for loop plot. The code i am using is the following</p>
  
  <pre><code>for i=3:14
     plot(data(:,i),data(:,2));
     hold all;
  end
  legend(textdata{1,3:14});
  </code></pre>
  
  <p>texdata is a <code>1x14 cell</code> where they are stored the names of the legends i want to use. 
  When i am running my script, i get the plot but instead of legend i am getting this error message "??? Index exceeds matrix dimensions."</p>
  
  <p>edit: i add the <code>whos textdata</code> answer, because i can't write it in a good way on comment answer</p>
  
  <pre><code>&gt;&gt; whos textdata
    Name          Size            Bytes  Class    Attributes
  
    textdata      1x14             1652  cell               
  </code></pre>