Headings for graphs generated in a loop

Hello,
Can anyone tell me how to go about having separate headings for graphs (and histograms) generated in a loop?
Thanks.

 Respuesta aceptada

Thorsten
Thorsten el 28 de En. de 2013
myheadings = {'first title' 'seccond title' 'yet another title' 'and so one'};
for i = 1:4
plot(rand(1,10))
title(myheadings{i})
pause(1)
end

4 comentarios

Tom
Tom el 28 de En. de 2013
That looks like the business. Thankyou!
Tom
Tom el 28 de En. de 2013
Actually... for some reason it's just putting myheadings(i) as the title for all of them. :(
Make sure to use curly braces
myheadings{i}
and that i is the index variable in your loop. Try the example.
Tom
Tom el 28 de En. de 2013
Yep. My brackets weren't curly enough. Thanks again.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

Tom
el 28 de En. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by