How to make figure title from multiple sources when looping
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Iain
le 21 Juin 2013
title([Scenario{i} ' Variable: ' num2str(j)]);
That should do it, and if not, try using Scenario(i) instead.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Title dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!