number of figure windows that are currently open?

11 ビュー (過去 30 日間)
Doug Ivers
Doug Ivers 2022 年 12 月 8 日
回答済み: Daniel Vieira 2022 年 12 月 8 日
In a script can I get the number of figure windows that are currently open?
Why?: as I re-run the script over and over to generate another figure, I'd like to position each new figure incrementally to the right

採用された回答

Bora Eryilmaz
Bora Eryilmaz 2022 年 12 月 8 日
編集済み: Bora Eryilmaz 2022 年 12 月 8 日
f1 = figure;
f2 = figure;
F = findobj('Type', 'figure')
F =
2×1 Figure array: Figure (2) Figure (1)
n = numel(F)
n = 2

その他の回答 (1 件)

Daniel Vieira
Daniel Vieira 2022 年 12 月 8 日
I do something like this:
for k=1:K
% my code here
figure;
% my plot here
fig=gcf; % get figure handle
fig.Position=[50+10*k 50+10*k fig.Position(3:4)]; % puts 1st image in pixel [50 50], second in [60 60], etc
end

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by