How to make figure title from multiple sources when looping
3 次查看(过去 30 天)
显示 更早的评论
The following script makes 6 figures with the headlines "Scenario X" where X=1,2,3. I want to include also "Vars2" in the title, because now you don't know which Vars that is reported in the figures. I want 6 different titles instead of only 3.I hve tried putting Vars2 next to Scenario in the title line, but it does not work.
Scenario={'Scenario 1', 'scenario 2', 'scenario 3'};
a = rand(1,2,3);
b= rand(1,2,3);
Vars = {a,b};
Vars2 = {'a', 'b'}
for j =1:2;
for i = 1:3;
Var=Vars{j}
figure, title(Scenario{i});
hold on
plot(Var(:,:,i));
end
end
Any ideas on how to fix this?
0 个评论
采纳的回答
Iain
2013-6-21
title([Scenario{i} ' Variable: ' num2str(j)]);
That should do it, and if not, try using Scenario(i) instead.
更多回答(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!