-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNamedFigure.m
34 lines (31 loc) · 923 Bytes
/
NamedFigure.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
function varargout = NamedFigure(Name)
% h = NamedFigure(Name)
% Looks for a figure with name Name, sets it to the current
% figure, and returns a handle h to the figure. If no such figure
% exists, it creates one, names it, and returns a handle
% INPUT:
% -Name The name of the figure
% OUTPUT:
% -h Handle to the figure
h = findobj('Name', Name);
if(length(h) == 0)
set(0, 'defaultaxesfontname', 'Arial')
set(0, 'defaulttextfontname', 'Arial')
set(0, 'defaultaxesfontsize', 15)
set(0, 'defaulttextfontsize', 18)
h = figure;
set(h, 'Name', Name)
set(h, 'Renderer', 'painters')
set(h, 'RendererMode', 'manual')
% title(Name); %No point to this, since it gets overwritten.
elseif(ishandle(h))
set(0, 'CurrentFigure', h)
else
h = figure(h);
end
switch(nargout)
case 0, varargout = {};
case 1, varargout = {h};
otherwise, error('Too many output arguments.');
end
return