adding a title to a figure - by a loop

I am trying to run with a loop where i have a parameter X when X = {'asd','asdf','sfdf','sd',....} and i want in every loop run to add to the title of the figure it's name.. I tried title(X(i),'dsfsdaasdsadf..') or tile('X(i)','sdfdsvsccvsd...') and nothing seems to work the end result that i am looking for is a bunch of figures that have the title i wanted by the order in X.. how can I do that?

 Akzeptierte Antwort

Chandra Kurniawan
Chandra Kurniawan am 26 Nov. 2011

2 Stimmen

Something like this??
clear all; clc;
X = {'asd','asdf','sfdf','sd'};
for i = 1 : length(X)
figure('name',X{i},'numbertitle','off');
end

4 Kommentare

Chandra Kurniawan
Chandra Kurniawan am 26 Nov. 2011
Or maybe something like this??
clear all; clc;
X = {'asd','asdf','sfdf','sd'};
for i = 1 : length(X)
figure, title(X{i});
end
alex
alex am 26 Nov. 2011
thanks, it works great
Suene
Suene am 17 Aug. 2015
many thanks for sharing!
K R
K R am 18 Mai 2017
Same code will it work for surf instead of normal 2d

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

am 26 Nov. 2011

Kommentiert:

K R
am 18 Mai 2017

Community Treasure Hunt

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

Start Hunting!

Translated by