How to automate the title of a graph
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I need to output several graphs with titles automatically. I want the titles to reflect a series of input data, but I do not know how to do this. Any ideas?
Here is an example of what I mean
c = input('select 1 or 2');
if c==1
length = 5;
width =2;
end
if c==2
length = 1;
width = 0.5;
end
If I select 1, I want my title on the figure to look like the following
Length = 5
Width = 2
There's got to be a way to code it so this gets done automatically, but I can't figure it out.
2 comentarios
dpb
el 17 de Jul. de 2013
Alternatively,
title(sprintf('Length = %d\nWidth = %d',[leng width]))
NB: STRONGLY suggest to not overload the builtin function LENGTH w/ the variable of the same name--this will only cause grief to do so later on when try to use the function to, say, control a for loop upper limit.
Respuestas (0)
Ver también
Categorías
Más información sobre Title en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!