Assume I had a matrix of dimension nX20. I want to plot each column using a loop, but there is some problem in giving a title for each plot in a loop. I want to give the titles data1, data2 and so on for each plot. My loop looks like this:
figure(k)
surf(squeeze(X),squeeze(Y),reshape(data(:,k),size(squeeze(X))),'edgecolor','none')
view(2)
axis equal
axis tight
set(gcf,'renderer','painters')
title('data')
colorbar
end

回答 (1 件)

Star Strider
Star Strider 2022 年 7 月 13 日

0 投票

Perhaps:
title(sprintf('data %3d',k))
.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2022a

質問済み:

2022 年 7 月 13 日

回答済み:

2022 年 7 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by