Produce a legend in for loop that takes entries from an array
이전 댓글 표시
Merry Christmas to all of you. I am trying to incorporate a legend in for loop. my code is the following:
s=['T '; 'Pb '; 'Pf '; 'Pc '; 'Psh '; 'Pito'];
t=cellstr(s);
figure
for k=1:length(pl(end,end,:))
for m=1:length(pl(:,end,end))
subplot(2,3,m) % BUSBAR
semilogx(dim(1,Nmin:Nmax,k)*1000,pl(m,Nmin:Nmax,k),'linewidth',2)
title(t(k))
hold all
end
end
My idea is simple. I want to have a legend that takes values from an array. So if for example I have six curves per plot, I would like to have one legend with 6 entries. I would like something like that because I change very frequently the number of entries and the entries themselves. To give you more details I would like to build a legend with 4 entries and each entry I would like to say 1cm 2cm 3cm 4cm. But I might change that later to 6 different entries.
For that reason I am trying to use a function from the matlab file exchange legend1.m. You can find this in: http://www.mathworks.in/matlabcentral/fileexchange/39505-legend1-m.
I didn't have any success yet. Can you help me please.
채택된 답변
추가 답변 (2개)
Giorgos Papakonstantinou
2012년 12월 25일
카테고리
도움말 센터 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!