Hi,
I am generating a plot in Matlab one point at a time depending on how a condition is satisfied within a loop:
for i=1:size(Ind,1) if(Ind(i)==1) c='ro'; elseif(Ind(i)==2) c='bo'; elseif(Ind(i)==3) c='go'; end plot(i,Y(i),c) %plotting some other value with the color chosen.
hold on end
How do I add a legend entry to this? I want to associate the index position(1,2 and 3) to red,blue and green in the legend.
Thanks!
Best Answer