0001 function status = Hide(parameter1,parameter2)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 status = [];
0031
0032
0033 name = mfilename;
0034
0035 default = get(0,'DefaultFigureCreateFcn');
0036 if isa(default,'function_handle'), default = func2str(default); end
0037
0038
0039 if nargin == 1 && isastring(lower(parameter1),'on','off','all','none','status'),
0040 switch lower(parameter1),
0041 case 'status',
0042 if isempty(regexp(default,name)),
0043 status = 'off';
0044 else
0045 status = 'on';
0046 end
0047 case 'on',
0048 if isempty(regexp(default,name)),
0049 set(0,'DefaultFigureCreateFcn',[name ';' default]);
0050 end
0051 case 'off',
0052 if ~isempty(regexp(default,name)),
0053 set(0,'DefaultFigureCreateFcn',regexprep(default,[name ';'],''));
0054 end
0055 case 'all',
0056 children = get(0,'children');
0057 for i = 1:length(children),
0058 if strcmp(get(children(i),'visible'),'on'),
0059
0060 set(children(i),'visible','off');
0061 end
0062 end
0063 case 'none',
0064 children = get(0,'children');
0065 for i = 1:length(children),
0066 if strcmp(get(children(i),'visible'),'off'),
0067
0068 set(children(i),'visible','on');
0069 end
0070 end
0071 end
0072 return
0073 end
0074
0075
0076 if ~isempty(gcbo),
0077
0078 set(gcbo,'visible','off');
0079 warning('FMAToolbox:Hide:FigureHidden','Figure hidden (type ''help <a href="matlab:help Hide">Hide</a>'' for details).');
0080
0081 current = get(gcbo,'CreateFcn');
0082 if isa(current,'function_handle'), current = func2str(current); end
0083 set(gcbo,'CreateFcn',regexprep(current,[name ';'],''));
0084 end
0085
0086
0087 if nargin < 1,
0088 figs = gcf;
0089 else
0090 figs = parameter1;
0091 end
0092 if nargin < 2,
0093 mode = 'on';
0094 else
0095 mode = lower(parameter2);
0096 end
0097
0098 switch mode,
0099 case 'off',
0100 for fig = figs,
0101 set(fig,'visible','on');
0102 end
0103 case 'on',
0104 for fig = figs,
0105 set(fig,'visible','off');
0106 end
0107 end
0108