I find how to make legend for one loop. But in my Case I have two loops.
I have data writen like that:
dataM(counterNetDefsave).PIvectorM{countersave} = PIvectorM;
counterNetDefsave is changing, and countersave is changing.
for counterNetDefsave = 1:length(HidLayCyclesIn:HidLayCyclesOut);
for countersave = 1:cycles;
dataM(counterNetDefsave).PIvectorM{countersave} = PIvectorM;
end
end
So what I want is ... for every countersave in every counterNetDefsave, like to have a plot and legend description for every line. Now I have plot like that:
plot(dataM(1,counterNetDefsave).PIvectorM{1,countersave}),'Color';clr(countersave,:);
Please help for all plots and legend to come together in one figure

 採用された回答

dpb
dpb 2013 年 10 月 7 日
編集済み: dpb 2013 年 10 月 8 日

0 投票

IIUC, you want to plot each column in the PIvectorM array...
Just use the vector form for input to plot
N=length(HidLayCyclesIn:HidLayCyclesOut); % length of x
plot([1:N]',dataM)
Then you can use legend with a cell array of labels of your choosing and they'll all match up automagically

1 件のコメント

mirch
mirch 2013 年 10 月 8 日
Thanks!!! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

質問済み:

2013 年 10 月 7 日

編集済み:

dpb
2013 年 10 月 8 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by