Adding sprintf values using a loop
12 ビュー (過去 30 日間)
古いコメントを表示
Dear group,
I'm trying to plot multiple subplots and adding names using loop.I tried to add a single name it works in a loop but adding multiple sprintf is snot changing the varibles ? What's the error in this?
Thanks in advance
figure
for k = 1 : 12
for a = 1:12
subplot(3,4,k);
Spec = ' A%d', 'S%d ';
caption = sprintf(Spec,k, a);
title(caption, 'FontSize', 12, 'HorizontalAlignment', 'center');
end
end
0 件のコメント
採用された回答
KALYAN ACHARJYA
2022 年 1 月 12 日
Spec =['A%d ','S%d'];
3 件のコメント
KALYAN ACHARJYA
2022 年 1 月 12 日
編集済み: KALYAN ACHARJYA
2022 年 1 月 12 日
yes sir Thanks @Stephen
@Ramesh Bala Are you looking for the following
Spec ='A%d S%d';
caption=sprintf(Spec,k,k)
if not, hope you noted about the nested loops iterations.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!