forked from cultpenguin/mGstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure_focus.m
48 lines (42 loc) · 1 KB
/
figure_focus.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% figure_focus : set focus (without rasising) to figure window
% i.e. window is not intrusively poppoing up in windows.
%
%
% Call :
% figure_focus(1); % open figure 1
% plot(rand(10,10));
% figure_focus(2); % open figure 2
% imagesc(rand(10,10);
% figure_focus(1); % set focus for figure (1), but do not raise it
% plot(rand(100,100));
%
%
%
% OLD version
% f=figure_focus(1); % open figure 1
% plot(rand(10,10));
% f=figure_focus(2,f); % open figure 2
% imagesc(rand(10,10);
% f=figure_focus(1,f); % set focus for figure (1), but do not raise it
% plot(rand(100,100));
%
function f=figure_focus(fig_id,f);
if nargin<1
f=gcf;return
end
if nargin<2
%f(fig_id)=figure(fig_id);
f(fig_id)=fig_id;
end
if length(f)<fig_id
f(fig_id)=0;
end
if f(fig_id)==0;
f(fig_id)=figure(fig_id);
else;
try
set(0,'CurrentFigure',f(fig_id));
catch
f(fig_id)=figure(fig_id);
end
end