How do I name figures in for loops.

33 ビュー (過去 30 日間)
Fadi Lama
Fadi Lama 2020 年 11 月 28 日
コメント済み: Fadi Lama 2020 年 11 月 28 日
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?

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 11 月 28 日
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'
  1 件のコメント
Fadi Lama
Fadi Lama 2020 年 11 月 28 日
Thanks! worked well

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by