フィルターのクリア

How do i make figures plotted in Matlab to appear in a chronological order?

16 ビュー (過去 30 日間)
Sachin NARAIN
Sachin NARAIN 2019 年 5 月 13 日
コメント済み: Rik 2019 年 5 月 13 日
I have 5 figures plotted .As we know , the cursor Matlab always takes us to the final 5th figure when we finsih our simulation.
How do i make figure 1 come first , then figure 2 , 3 , 4 and then 5 in an order?
Thank you in advance

採用された回答

Rik
Rik 2019 年 5 月 13 日
You can bring focus to a figure with the figure function:
h=struct;
h.f=zeros(1,5);%will contain the handles to the figures
for n=1:5
h.f(n)=figure(n)
plot(rand(1,10),1:10)
end
%bring focus to the figures in reverse order
for n=numel(h.f):-1:1
figure(h.f(n))
end
  2 件のコメント
Sachin NARAIN
Sachin NARAIN 2019 年 5 月 13 日
Thank you.Helps a lot
Rik
Rik 2019 年 5 月 13 日
Note that this only brings the focus to the figures visually and will work for most applications. In edge cases you might need the function below (written by Jan, which he recently posted again here).
function FocusToFig(ObjH, EventData)
FigH = ancestor(ObjH, 'figure');
% Work-around
if strcmpi(get(ObjH, 'Type'), 'uicontrol')
set(ObjH, 'Enable', 'off');
drawnow;
set(ObjH, 'Enable', 'on');
pause(0.02); % Give the re-enabled control a chance to be rendered
end
% Methods according to the documentation (does not move the focus for
% keyboard events under Matlab 5.3, 6.5, 2008b, 2009a):
figure(FigH);
set(groot, 'CurrentFigure', FigH);
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by