How do I name figures in for loops.

31 Ansichten (letzte 30 Tage)
Fadi Lama
Fadi Lama am 28 Nov. 2020
Kommentiert: Fadi Lama am 28 Nov. 2020
My for loop is i=1:10 in which 10 plots wre produced at 10 different locations. I would like to name the figures as 'location i' where i is 1,2,3,...10 but without having to name each figure individually. Is there a function to do this?

Antworten (1)

Walter Roberson
Walter Roberson am 28 Nov. 2020
for i = 1 : 2
fig(i) = figure('name', sprintf('location %d', i));
end
fig(1).Name
ans = 'location 1'
fig(2).Name
ans = 'location 2'

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by