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!