Automatically assign legend name to set of data
Mostra commenti meno recenti
Hello,
I have to plot different curves in a single graph. The number of the curves to plot can change. I would like to automatically rename the various curves by replacing the default name data1, data2, ecc...
Is there a simple way to do this?
I attach a simplified version of my code.
Thank you very much for your help
n=input('Enter the number of curves you want to fit: ');
m=10;
x=zeros(m,1);
y=zeros(m,n);
x(:,1)=1:1:m;
for k=1:n
for j=1:m
y(j,k)=k+j;
end
end
figure()
semilogx(x(:,1),y(:,:),"o")
legend()
%how to rename y(:,1), y(:,2) etc... with y1, y2, ecc...???
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Legend in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
