How to make figure title from multiple sources when looping

2 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Iain
Iain el 21 de Jun. de 2013
title([Scenario{i} ' Variable: ' num2str(j)]);
That should do it, and if not, try using Scenario(i) instead.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by