Switching current figure by name silently

6 views
Skip to first unread message

Haifeng GONG

unread,
May 19, 2010, 6:18:01 PM5/19/10
to MathTools
function hr = get_figure(name)

% If we switch current figure in a loop, Matlab brings the figure to
the front.
% If the program runs a long time, this behavior is boring while we
are working on other program simultaneously.
% This function will suppress this unwanted behavior.


h = findobj('Name', name);

for ii=1:length(h)
if strcmp('figure', get(h, 'Type')) ~=0
%figure(h(ii));
hr = h(ii);
set(0, 'CurrentFigure', hr);
return;
end
end

hr = figure('Name', name);

--
You received this message because you are subscribed to the Google Groups "MathTools" group.
To post to this group, send email to math...@googlegroups.com.
To unsubscribe from this group, send email to mathtools+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mathtools?hl=en.

Reply all
Reply to author
Forward
0 new messages