Holding plot legend inside loop & between two for loops

 采纳的回答

I would recommend against this workflow. Insert the legend once at the end. For example:
figure;
hold on;
h =zeros(10,1);
colors = 'rgbcyk';
for ii = 1:numel(h);
h(ii) = plot(1:10,rand(1,10)+sin(rand(1,10)),colors(rem(ii,6)+1));
end
legend(h)

更多回答(0 个)

类别

标签

Community Treasure Hunt

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

Start Hunting!

Translated by