How to change ylabels in a for loop
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone, I have a simple for loop to plot 7 different plots, but the ylabel should be different.
for k=1:7;
figure
bar(GAMMA_sta(k,:))
xlabel('Rock Types');
title( [ 'Statistics of Rocks', num2str(k)] );
end
Anyone knows how to change ylabel for each plot in a for loop please let me know. Thanks. My 7 plots should have 7 different ylabels.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 14 Mai 2012
For example,
ylabel(sprintf('Plot #%d', k))
It would be easier if you indicated how you want the different ylabel to look.
4 Kommentare
Walter Roberson
am 14 Mai 2012
Before loop:
ylabs = {'Mean', 'Std', '1st Moment', 'Allegro', 'Geraniums', 'Circularity', 'Disco'};
Inside loop:
ylabel(ylabs{k});
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!