How to change ylabels in a for loop

5 ビュー (過去 30 日間)
Lei
Lei 2012 年 5 月 14 日
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.

採用された回答

Walter Roberson
Walter Roberson 2012 年 5 月 14 日
For example,
ylabel(sprintf('Plot #%d', k))
It would be easier if you indicated how you want the different ylabel to look.
  4 件のコメント
Walter Roberson
Walter Roberson 2012 年 5 月 14 日
Before loop:
ylabs = {'Mean', 'Std', '1st Moment', 'Allegro', 'Geraniums', 'Circularity', 'Disco'};
Inside loop:
ylabel(ylabs{k});
Lei
Lei 2012 年 5 月 14 日
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.
Cheers!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by