How to change ylabels in a for loop

14 Ansichten (letzte 30 Tage)
Lei am 14 Mai 2012
Hello everyone, I have a simple for loop to plot 7 different plots, but the ylabel should be different.
for k=1:7;
xlabel('Rock Types');
title( [ 'Statistics of Rocks', num2str(k)] );
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.

Akzeptierte Antwort

Walter Roberson
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
Lei am 14 Mai 2012
Hi Oleg and Walter,
Thanks for your guys help! They work fine!
I guess the idea is put my ylabels in a cell and then index them.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by