String array for creating titles for multiple Figures:

12 visualizaciones (últimos 30 días)
David
David el 27 de Feb. de 2012
So I have a program that creates 8 figures, and I would like to create an array of strings where titles = ['bla1' 'bla2' ... 'bla8']; and then after each loop i have an index variable that will name that graph appropriately. The problem is it uses the index number for the first string. So the title of the graph in figure 1 is b, and the title of the graph in figure 2 is l and so on. I was wondering if there is anyway I can do something similar to the method I listed where I can do this with an array, or do I have to painfully name each graph individually? (which i would have no idea how to with my current set up.)
Btw i have 3 for loops where:
for a = 1:2
for b = 1:2
for c = 1:2
.
.
(some code for creating points)
.
.
figure;
subplot(2,1,1)
plot(SNR,PD,'-r*')
subplot(2,1,2)
plot(SNR,PFA,'-b*')
title(titles(indexOfTitle));
indexOfTitle = indexOfTitle + 1;
end
end
end
Thanks David

Respuestas (1)

David
David el 28 de Feb. de 2012
I figured it out. All i had to do was replace the [] with {}. This changes the strings to cells so it reads the whole string instead part of it.

Categorías

Más información sobre Title en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by