title: Accessing legend entries exceeds matrix dimensions
body: <p>I am trying to plot some data with Matlab R2015a and as the data sets are changing for different plots I want to create the legend (semi-)automatically. I do this with a list of strings (called list) and then</p>
  
  <pre><code>leg = legend(list);
  legtxt=findobj(leg,'type','text');
  set(legtxt(1),'color','r');
  set(legtxt(2),'color','b');
  </code></pre>
  
  <p>a.s.o. according to the entries.</p>
  
  <p>However, no matter what index I give in the 'set(legtxt(i))' part, Matlab always tells me 'Index exceeds matrix dimensions.' Same, if I create the the legend manually by not using 'legend(list)' but explicitly typing the legend entries. Does anyone know why this happens or how to solve it? Thanks!</p>