www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/convolution/convexpogui.m
function varargout = convexpogui(varargin) % CONVEXPOGUI M-file for convexpogui.fig % CONVEXPOGUI, by itself, creates a new CONVEXPOGUI or raises the existing % singleton*. % % H = CONVEXPOGUI returns the handle to a new CONVEXPOGUI or the handle to % the existing singleton*. % % CONVEXPOGUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in CONVEXPOGUI.M with the given input arguments. % % CONVEXPOGUI('Property','Value',...) creates a new CONVEXPOGUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before convexpogui_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to convexpogui_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help convexpogui % Last Modified by GUIDE v2.5 27-Apr-2004 13:36:39 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @convexpogui_OpeningFcn, ... 'gui_OutputFcn', @convexpogui_OutputFcn, ... 'gui_LayoutFcn', @convexpogui_LayoutFcn, ... 'gui_Callback', []); if nargin & isstr(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before convexpogui is made visible. function convexpogui_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; set(gcf,'UserData',handles); guidata(hObject, handles); convexpofn; if nargin > 3 datastruct = varargin{1}; convexpofn('readinput',datastruct); end % --- Outputs from this function are returned to the command line. function varargout = convexpogui_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in stepback. function stepback_Callback(hObject, eventdata, handles) convexpofn('stepback'); % --- Executes on button press in stepforw. function stepforw_Callback(hObject, eventdata, handles) convexpofn('stepforw'); % --- Executes during object creation, after setting all properties. function width1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function width1_Callback(hObject, eventdata, handles) convexpofn('width1'); % --- Executes during object creation, after setting all properties. function width2_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function width2_Callback(hObject, eventdata, handles) convexpofn('width2'); % --- Executes during object creation, after setting all properties. function length1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function length1_Callback(hObject, eventdata, handles) convexpofn('length1'); % --- Executes during object creation, after setting all properties. function length2_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function length2_Callback(hObject, eventdata, handles) convexpofn('length2'); % --- Executes on button press in play. function play_Callback(hObject, eventdata, handles) convexpofn('play'); % --- Executes on button press in reset. function reset_Callback(hObject, eventdata, handles) convexpofn('reset'); % --- Executes during object creation, after setting all properties. function pulse1_type_CreateFcn(hObject, eventdata, handles) % hObject handle to pulse1_type (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in pulse1_type. function pulse1_type_Callback(hObject, eventdata, handles) convexpofn('pulse1'); % --- Executes during object creation, after setting all properties. function pulse2_type_CreateFcn(hObject, eventdata, handles) % hObject handle to pulse2_type (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in pulse2_type. function pulse2_type_Callback(hObject, eventdata, handles) convexpofn('pulse2'); contents = get(hObject,'String'); switch contents{get(hObject,'Value')} case 'custom' %set(handles.width2,'Enable','inactive'); otherwise set(handles.width2,'Enable','on'); end % --- Executes on button press in showshape. function showshape_Callback(hObject, eventdata, handles) convexpofn('showshape'); % --- Executes on button press in grid. function grid_Callback(hObject, eventdata, handles) convexpofn('grid'); % --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function edit5_Callback(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit5 as text % str2double(get(hObject,'String')) returns contents of edit5 as a double % --- Executes on button press in cyclic. function cyclic_Callback(hObject, eventdata, handles) convexpofn 'cyclic'; % -------------------------------------------------------------------- function help_Callback(hObject, eventdata, handles) % hObject handle to help (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) convexpofn 'help'; % --- Creates and returns a handle to the GUI figure. function h1 = convexpogui_LayoutFcn(policy) % policy - create a new figure or use a singleton. 'new' or 'reuse'. persistent hsingleton; if strcmpi(policy, 'reuse') & ishandle(hsingleton) h1 = hsingleton; return; end h1 = figure(... 'Units','characters',... 'Color',[0.701960784313725 0.701960784313725 0.701960784313725],... 'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],... 'DoubleBuffer','on',... 'IntegerHandle','off',... 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),... 'MenuBar','none',... 'Name','convexpo',... 'NumberTitle','off',... 'PaperPosition',[0.25 2.5 8 8],... 'Position',[103.8 23.5961538461538 102.4 42.6153846153846],... 'Renderer',get(0,'defaultfigureRenderer'),... 'RendererMode','manual',... 'HandleVisibility','callback',... 'Tag','convexpo_fig',... 'UserData',[]); setappdata(h1, 'GUIDEOptions',struct(... 'active_h', [], ... 'taginfo', struct(... 'figure', 2, ... 'text', 16, ... 'axes', 4, ... 'pushbutton', 6, ... 'edit', 6, ... 'frame', 3, ... 'popupmenu', 3, ... 'checkbox', 4), ... 'override', 1, ... 'release', 13, ... 'resize', 'simple', ... 'accessibility', 'callback', ... 'mfile', 1, ... 'callbacks', 1, ... 'singleton', 1, ... 'syscolorfig', 1, ... 'lastSavedFile', '/Users/bobsturm/gibson/SSUM/convolution/convexpo.m', ... 'blocking', 0)); h2 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'ListboxTop',0,... 'Position',[79.7948717948718 14.6097046413502 20.9230769230769 11.0198915009042],... 'String',{ '' },... 'Style','frame',... 'Tag','frame2'); h3 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'ListboxTop',0,... 'Position',[79.7948717948718 25.9635322483424 20.9230769230769 11.0198915009042],... 'String',{ '' },... 'Style','frame',... 'Tag','frame1'); h4 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 29 10.2 1.5],... 'String','Width',... 'Style','text',... 'Tag','text8'); h5 = axes(... 'Parent',h1,... 'Units','characters',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'Position',[5.53846153846154 25.9635322483424 73.6410256410257 11.0198915009042],... 'XColor',get(0,'defaultaxesXColor'),... 'YColor',get(0,'defaultaxesYColor'),... 'ZColor',get(0,'defaultaxesZColor'),... 'Tag','axes1'); h6 = get(h5,'title'); set(h6,... 'Parent',h5,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.5 1.04924242424242 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h7 = get(h5,'xlabel'); set(h7,... 'Parent',h5,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.497214484679666 -0.178030303030303 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h8 = get(h5,'ylabel'); set(h8,... 'Parent',h5,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.0654596100278552 0.488636363636364 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h9 = get(h5,'zlabel'); set(h9,... 'Parent',h5,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-0.0766016713091922 1.49621212121212 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h10 = axes(... 'Parent',h1,... 'Units','characters',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'Position',[5.53846153846154 14.6097046413502 73.6410256410257 11.0198915009042],... 'XColor',get(0,'defaultaxesXColor'),... 'YColor',get(0,'defaultaxesYColor'),... 'ZColor',get(0,'defaultaxesZColor'),... 'Tag','axes2'); h11 = get(h10,'title'); set(h11,... 'Parent',h10,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.5 1.04924242424242 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h12 = get(h10,'xlabel'); set(h12,... 'Parent',h10,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.497214484679666 -0.178030303030303 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h13 = get(h10,'ylabel'); set(h13,... 'Parent',h10,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.0654596100278552 0.488636363636364 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h14 = get(h10,'zlabel'); set(h14,... 'Parent',h10,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-0.0766016713091922 2.52651515151515 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h15 = axes(... 'Parent',h1,... 'Units','characters',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'Position',[5.53846153846154 3.17239300783604 73.6410256410257 11.0198915009042],... 'XColor',get(0,'defaultaxesXColor'),... 'YColor',get(0,'defaultaxesYColor'),... 'ZColor',get(0,'defaultaxesZColor'),... 'Tag','axes3'); h16 = get(h15,'title'); set(h16,... 'Parent',h15,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.5 1.04924242424242 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h17 = get(h15,'xlabel'); set(h17,... 'Parent',h15,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.497214484679666 -0.178030303030303 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h18 = get(h15,'ylabel'); set(h18,... 'Parent',h15,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.0654596100278552 0.488636363636363 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h19 = get(h15,'zlabel'); set(h19,... 'Parent',h15,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-0.0766016713091922 3.56439393939394 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h20 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 17.3076923076923 10.2 1.5],... 'String','Width',... 'Style','text',... 'Tag','text9'); h21 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'CData',[],... 'FontSize',18,... 'FontWeight','bold',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[2.16666666666667 39.6666666666667 69.5 2.41666666666667],... 'String','Convolution Explorer',... 'Style','text',... 'Tag','text1',... 'UserData',[]); h22 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'ListboxTop',0,... 'Position',[86 11.6923076923077 8.2 1.5],... 'String','Step',... 'Style','text',... 'Tag','text7'); h23 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''stepback_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.385667752443 11.6526442307692 6.00390879478827 1.5],... 'String','<<',... 'Tag','stepback'); h24 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''stepforw_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[94.228013029316 11.6526442307692 6.00390879478827 1.5],... 'String','>>',... 'Tag','stepforw'); h25 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''width1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[81.6 27.4615384615385 10.2 1.5],... 'String','1',... 'Style','edit',... 'CreateFcn','convexpogui(''width1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','width1'); h26 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''width2_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[81.6 15.8461538461538 10.2 1.5],... 'String','1',... 'Style','edit',... 'CreateFcn','convexpogui(''width2_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','width2'); h27 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'FontWeight','bold',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 34.7692307692308 11.4 1.5],... 'String','Pulse 1',... 'Style','text',... 'Tag','text10'); h28 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'FontWeight','bold',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 23.5384615384615 12 1.5],... 'String','Pulse 2',... 'Style','text',... 'Tag','text11'); h29 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''reset_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.385667752443 8.90594951923077 9.00586319218241 1.5],... 'String','Reset',... 'Tag','reset'); h30 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''pulse1_type_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[81.6 31.0769230769231 16.6 1.5],... 'String',{ 'square'; 'triangle'; 'sine1'; 'sine2'; 'sine3'; 'random' },... 'Style','popupmenu',... 'Value',1,... 'CreateFcn','convexpogui(''pulse1_type_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','pulse1_type'); h31 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''pulse2_type_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[81.6 19.6153846153846 16.4 1.5],... 'String',{ 'square'; 'triangle'; 'sine1'; 'sine2'; 'sine3'; 'random'; 'custom' },... 'Style','popupmenu',... 'Value',1,... 'CreateFcn','convexpogui(''pulse2_type_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','pulse2_type'); h32 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''play_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[91.3928338762215 8.90594951923077 9.00586319218241 1.5],... 'String','Play',... 'Tag','play'); h33 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''showshape_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.5524429967427 4.99399038461539 19.5127035830619 1.5],... 'String','Show Shape',... 'Style','checkbox',... 'Tag','showshape'); h34 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''grid_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.5524429967427 3.07962740384615 19.5127035830619 1.5],... 'String','Grid',... 'Style','checkbox',... 'Value',1,... 'Tag','grid'); h35 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','convexpogui(''cyclic_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.5524429967427 6.90835336538461 19.5127035830619 1.5],... 'String','Cyclic',... 'Style','checkbox',... 'Tag','cyclic'); h36 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 32.6923076923077 10.2 1.46153846153846],... 'String','Shape',... 'Style','text',... 'Tag','text14'); h37 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',12,... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[81.6 21.2307692307692 10.2 1.5],... 'String','Shape',... 'Style','text',... 'Tag','text15'); h38 = uimenu(... 'Parent',h1,... 'Callback','convexpogui(''help_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Help',... 'Tag','help'); hsingleton = h1; % --- Handles default GUIDE GUI creation and callback dispatch function varargout = gui_mainfcn(gui_State, varargin) gui_StateFields = {'gui_Name' 'gui_Singleton' 'gui_OpeningFcn' 'gui_OutputFcn' 'gui_LayoutFcn' 'gui_Callback'}; gui_Mfile = ''; for i=1:length(gui_StateFields) if ~isfield(gui_State, gui_StateFields{i}) error('Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile); elseif isequal(gui_StateFields{i}, 'gui_Name') gui_Mfile = [getfield(gui_State, gui_StateFields{i}), '.m']; end end numargin = length(varargin); if numargin == 0 % CONVEXPOGUI % create the GUI gui_Create = 1; elseif numargin > 3 & ischar(varargin{1}) & ishandle(varargin{2}) % CONVEXPOGUI('CALLBACK',hObject,eventData,handles,...) gui_Create = 0; else % CONVEXPOGUI(...) % create the GUI and hand varargin to the openingfcn gui_Create = 1; end if gui_Create == 0 varargin{1} = gui_State.gui_Callback; if nargout [varargout{1:nargout}] = feval(varargin{:}); else feval(varargin{:}); end else if gui_State.gui_Singleton gui_SingletonOpt = 'reuse'; else gui_SingletonOpt = 'new'; end % Open fig file with stored settings. Note: This executes all component % specific CreateFunctions with an empty HANDLES structure. % Do feval on layout code in m-file if it exists if ~isempty(gui_State.gui_LayoutFcn) gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt); else gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); % If the figure has InGUIInitialization it was not completely created % on the last pass. Delete this handle and try again. if isappdata(gui_hFigure, 'InGUIInitialization') delete(gui_hFigure); gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt); end end % Set flag to indicate starting GUI initialization setappdata(gui_hFigure,'InGUIInitialization',1); % Fetch GUIDE Application options gui_Options = getappdata(gui_hFigure,'GUIDEOptions'); if ~isappdata(gui_hFigure,'GUIOnScreen') % Adjust background color if gui_Options.syscolorfig set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor')); end % Generate HANDLES structure and store with GUIDATA guidata(gui_hFigure, guihandles(gui_hFigure)); end % If user specified 'Visible','off' in p/v pairs, don't make the figure % visible. gui_MakeVisible = 1; for ind=1:2:length(varargin) if length(varargin) == ind break; end len1 = min(length('visible'),length(varargin{ind})); len2 = min(length('off'),length(varargin{ind+1})); if ischar(varargin{ind}) & ischar(varargin{ind+1}) & ... strncmpi(varargin{ind},'visible',len1) & len2 > 1 if strncmpi(varargin{ind+1},'off',len2) gui_MakeVisible = 0; elseif strncmpi(varargin{ind+1},'on',len2) gui_MakeVisible = 1; end end end % Check for figure param value pairs for index=1:2:length(varargin) if length(varargin) == index break; end try, set(gui_hFigure, varargin{index}, varargin{index+1}), catch, break, end end % If handle visibility is set to 'callback', turn it on until finished % with OpeningFcn gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); if strcmp(gui_HandleVisibility, 'callback') set(gui_hFigure,'HandleVisibility', 'on'); end feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:}); if ishandle(gui_hFigure) % Update handle visibility set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); % Make figure visible if gui_MakeVisible set(gui_hFigure, 'Visible', 'on') if gui_Options.singleton setappdata(gui_hFigure,'GUIOnScreen', 1); end end % Done with GUI initialization rmappdata(gui_hFigure,'InGUIInitialization'); end % If handle visibility is set to 'callback', turn it on until finished with % OutputFcn if ishandle(gui_hFigure) gui_HandleVisibility = get(gui_hFigure,'HandleVisibility'); if strcmp(gui_HandleVisibility, 'callback') set(gui_hFigure,'HandleVisibility', 'on'); end gui_Handles = guidata(gui_hFigure); else gui_Handles = []; end if nargout [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); else feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles); end if ishandle(gui_hFigure) set(gui_hFigure,'HandleVisibility', gui_HandleVisibility); end end function gui_hFigure = local_openfig(name, singleton) try gui_hFigure = openfig(name, singleton, 'auto'); catch % OPENFIG did not accept 3rd input argument until R13, % toggle default figure visible to prevent the figure % from showing up too soon. gui_OldDefaultVisible = get(0,'defaultFigureVisible'); set(0,'defaultFigureVisible','off'); gui_hFigure = openfig(name, singleton); set(0,'defaultFigureVisible',gui_OldDefaultVisible); end