figure title in a loop
1 回表示 (過去 30 日間)
古いコメントを表示
I am producing a subplot inside a for loop with the following:
for i=1:length(fieldnames(Data));
subplot(length(fieldnames(Data)),1,i);
plot(Data.(Name{i}));
end
Next I want one title which lists the fieldnames, something like:
title('Temperature a)fieldname1 b)fieldname2 c)fieldname3')
However, I don't know how to make the fieldname for 'Data' to appear in the title command.
0 件のコメント
採用された回答
Chandra Kurniawan
2012 年 1 月 10 日
names = fieldnames(Data);
for i = 1 : length(names);
subplot(length(names),1,i);
%plot(Data.(Name{i}));
title(names{i});
end
2 件のコメント
Chandra Kurniawan
2012 年 1 月 10 日
str = 'Temperature : ';
for i = 1 : length(names);
str = strcat(str, num2str(i),'] ',names{i});
end
And then use str as title.
Eq : title(str);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!