www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/spectrum/spectrum/spectrumexpogui.m
function varargout = spectrumexpogui(varargin) % SPECTRUMEXPOGUI.m-file for spectrumexpogui.fig % SPECTRUMEXPOGUI, by itself, creates a new SPECTRUMEXPOGUI or raises the existing % singleton*. % % H = SPECTRUMEXPOGUI returns the handle to a new SPECTRUMEXPOGUI or the handle to % the existing singleton*. % % SPECTRUMEXPOGUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in SPECTRUMEXPOGUI.M with the given input arguments. % % SPECTRUMEXPOGUI('Property','Value',...) creates a new SPECTRUMEXPOGUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before spectrumexpogui_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to spectrumexpogui_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 % Last Modified by GUIDE v2.5 19-Apr-2004 11:58:43 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @spectrumexpogui_OpeningFcn, ... 'gui_OutputFcn', @spectrumexpogui_OutputFcn, ... 'gui_LayoutFcn', @spectrumexpogui_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 sinesumgui2 is made visible. function spectrumexpogui_OpeningFcn(hObject, eventdata, handles, varargin) handles.output = hObject; guidata(hObject, handles); set(gcf,'UserData',handles); spectrumexpofn; %if strcmp(get(hObject,'Visible'),'off') % update_Callback(hObject, eventdata, handles) %end % --- Outputs from this function are returned to the command line. function varargout = spectrumexpogui_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; function popupmenu1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end set(hObject, 'String', {'Sum', 'Product'}); function popupmenu1_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; function freq1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function freq2_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function amp1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function amp2_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function phase1_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function phase2_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % Executes on textbox entry function freq1_Callback(hObject, eventdata, handles) freq1 = str2double(get(hObject,'String')); if freq1 < 20.1 freq1 = 20.1; elseif freq1 > 22042 freq1 = 22042; end set(handles.freq1,'String',num2str(freq1)); set(handles.freq1slider,'Value',log2(freq1)); spectrumexpofn 'update'; function freq2_Callback(hObject, eventdata, handles) freq2 = str2double(get(hObject,'String')); if freq2 < 20.1 freq2 = 20.1; elseif freq2 > 22042 freq2 = 22042; end set(handles.freq2,'String',num2str(freq2)); set(handles.freq2slider,'Value',log2(freq2)); spectrumexpofn 'update'; function amp1_Callback(hObject, eventdata, handles) amp1 = str2double(get(hObject,'String')); if amp1 < 0 amp1 = 0; elseif amp1 > 2 amp1 = 2; end set(handles.amp1,'String',num2str(amp1)); set(handles.amp1slider,'Value',amp1); spectrumexpofn 'update'; function amp2_Callback(hObject, eventdata, handles) amp2 = str2double(get(hObject,'String')); if amp2 < 0 amp2 = 0; elseif amp2 > 2 amp2 = 2; end set(handles.amp2,'String',num2str(amp2)); set(handles.amp2slider,'Value',amp2); spectrumexpofn 'update'; function phase1_Callback(hObject, eventdata, handles) phase1 = str2double(get(hObject,'String')); if phase1 < -180 while phase1 < -180 phase1 = phase1 + 360; end elseif phase1 > 180 while phase1 > 180 phase1 = phase1 - 360; end end set(handles.phase1,'String',num2str(phase1)); set(handles.phase1slider,'Value',phase1); spectrumexpofn 'update'; function phase2_Callback(hObject, eventdata, handles) phase2 = str2double(get(hObject,'String')); if phase2 < -180 while phase2 < -180 phase2 = phase2 + 360; end elseif phase2 > 180 while phase2 > 180 phase2 = phase2 - 360; end end set(handles.phase2,'String',num2str(phase2)); set(handles.phase2slider,'Value',phase2); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function freq1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function freq1slider_Callback(hObject, eventdata, handles) freq1 = num2str(2^get(hObject,'Value')); set(handles.freq1,'String',freq1); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function amp1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function amp1slider_Callback(hObject, eventdata, handles) amp1 = num2str(get(hObject,'Value')); set(handles.amp1,'String',amp1); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function phase1slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function phase1slider_Callback(hObject, eventdata, handles) phase1 = num2str(get(hObject,'Value')); set(handles.phase1,'String',phase1); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function freq2slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function freq2slider_Callback(hObject, eventdata, handles) freq2 = num2str(2^get(hObject,'Value')); set(handles.freq2,'String',freq2); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function amp2slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function amp2slider_Callback(hObject, eventdata, handles) amp2 = num2str(get(hObject,'Value')); set(handles.amp2,'String',amp2); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function phase2slider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function phase2slider_Callback(hObject, eventdata, handles) phase2 = num2str(get(hObject,'Value')); set(handles.phase2,'String',phase2); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function offset_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function offset_Callback(hObject, eventdata, handles) offset = str2double(get(hObject,'String')); if offset < 0 offset = 0; elseif offset > 1 offset = 1; end set(handles.offset,'String',num2str(offset)); set(handles.offsetslider,'Value',offset); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function offsetslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function offsetslider_Callback(hObject, eventdata, handles) offset = num2str(get(hObject,'Value')); set(handles.offset,'String',offset); spectrumexpofn 'update'; %% --- Executes on button press in updatebutton. %function updatebutton_Callback(hObject, eventdata, handles) % update_Callback(hObject, eventdata, handles) % --- Executes on button press in play. function play_Callback(hObject, eventdata, handles) spectrumexpofn 'play'; % --- Executes during object creation, after setting all properties. function plotype_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in plotype. function plotype_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function Fstext_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function Fstext_Callback(hObject, eventdata, handles) Fs = str2double(get(hObject,'String')); if (Fs > 44100) Fs = 44100; end if (Fs < 21) Fs = 21; end set(handles.Fsslider,'Value',log2(Fs)); set(handles.Fstext,'String',num2str(Fs)); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function Fsslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function Fsslider_Callback(hObject, eventdata, handles) Fs = ceil(2^get(hObject,'Value')); if (Fs > 44100) Fs = 44100; end if (Fs < 0) Fs = 0; end set(handles.Fsslider,'Value',log2(Fs)); set(handles.Fstext,'String',num2str(Fs)); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function durationtext_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function durationtext_Callback(hObject, eventdata, handles) duration = str2double(get(hObject,'String')); if duration <= 0 duration = 0.01; set(handles.durationtext,'String',num2str(duration)); end set(handles.durationslider,'Value',duration); spectrumexpofn 'update'; % --- Executes during object creation, after setting all properties. function durationslider_CreateFcn(hObject, eventdata, handles) usewhitebg = 1; if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on slider movement. function durationslider_Callback(hObject, eventdata, handles) duration = num2str(get(hObject,'Value')); set(handles.durationtext,'String',duration); spectrumexpofn 'update'; % --- Executes on button press in gridbox. function gridbox_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes on button press in plot1box. function plot1box_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes on button press in plot2box. function plot2box_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes on button press in spectrumbutton. function spectrumbutton_Callback(hObject, eventdata, handles) spectrumexpofn 'spectrum'; % --- Executes on button press in interpbox. function interpbox_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes on button press in samplebox. function samplebox_Callback(hObject, eventdata, handles) spectrumexpofn 'update'; % --- Executes when user attempts to close spectrumexpogui_fig. function spectrumexpogui_fig_CloseRequestFcn(hObject, eventdata, handles) % hObject handle to spectrumexpogui_fig (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: delete(hObject) closes the figure delete(hObject); % -------------------------------------------------------------------- function Untitled_1_Callback(hObject, eventdata, handles) % hObject handle to Untitled_1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % -------------------------------------------------------------------- function fourier_Callback(hObject, eventdata, handles) % hObject handle to fourier (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) spectrumexpofn 'fourier'; % -------------------------------------------------------------------- function sonogram_Callback(hObject, eventdata, handles) % hObject handle to Untitled_3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) spectrumexpofn 'sonogram'; % -------------------------------------------------------------------- function alias_Callback(hObject, eventdata, handles) % hObject handle to Untitled_2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) spectrumexpofn 'alias'; % -------------------------------------------------------------------- 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) spectrumexpofn 'help'; % --- Creates and returns a handle to the GUI figure. function h1 = spectrumexpogui_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],... 'IntegerHandle','off',... 'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),... 'KeyPressFcn','update_Callback(hObject, eventdata, handles)',... 'MenuBar','none',... 'Name','spectrumexpo',... 'NumberTitle','off',... 'PaperPosition',get(0,'defaultfigurePaperPosition'),... 'Position',[128.6 -8.85897435897435 113.833333333333 63.1666666666667],... 'Renderer',get(0,'defaultfigureRenderer'),... 'RendererMode','manual',... 'HandleVisibility','callback',... 'Tag','spectrumexpo_fig',... 'UserData',[]); setappdata(h1, 'GUIDEOptions',struct(... 'active_h', [], ... 'taginfo', struct(... 'figure', 2, ... 'axes', 7, ... 'pushbutton', 5, ... 'popupmenu', 3, ... 'edit', 14, ... 'text', 17, ... 'slider', 13, ... 'frame', 4, ... 'togglebutton', 2, ... 'checkbox', 7), ... 'override', 1, ... 'release', 13, ... 'resize', 'simple', ... 'accessibility', 'callback', ... 'mfile', 1, ... 'callbacks', 1, ... 'singleton', 1, ... 'syscolorfig', 1, ... 'lastSavedFile', '/Users/bobsturm/gibson/SSUM/spectrum/spectrum/spectrumexpo.m', ... 'blocking', 0)); h2 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.1666666666667 41.75 100 10],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','sinsum',... 'UserData',[]); h3 = get(h2,'title'); set(h3,... 'Parent',h2,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 1.04421768707483 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h4 = get(h2,'xlabel'); set(h4,... 'Parent',h2,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 -0.153061224489796 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h5 = get(h2,'ylabel'); set(h5,... 'Parent',h2,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.163265306122449 0.493197278911564 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h6 = get(h2,'zlabel'); set(h6,... 'Parent',h2,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-1.48979591836735 2.14625850340136 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h7 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'ListboxTop',0,... 'Position',[58.1666666666667 7 53.5 9.25],... 'String',{ '' },... 'Style','frame',... 'Tag','frame2',... 'UserData',[]); h8 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'ListboxTop',0,... 'Position',[2.16666666666667 3.75 53.5 12.5],... 'String',{ '' },... 'Style','frame',... 'Tag','frame1',... 'UserData',[]); h9 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''freq1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41.6666666666667 14.0833333333333 12.1666666666667 1.5],... 'String','440',... 'Style','edit',... 'Value',440,... 'ButtonDownFcn','spectrumexpogui(''freq1_ButtonDownFcn'',gcbo,[],guidata(gcbo))',... 'CreateFcn','spectrumexpogui(''freq1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq1'); h10 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''amp1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41.6666666666667 11.3333333333333 12.1666666666667 1.5],... 'String','0.5',... 'Style','edit',... 'CreateFcn','spectrumexpogui(''amp1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp1'); h11 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''phase1_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41.6666666666667 8.66666666666667 12.1666666666667 1.5],... 'String','0.0',... 'Style','edit',... 'CreateFcn','spectrumexpogui(''phase1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase1'); h12 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[4 13.8333333333333 16.3333333333333 1.33333333333333],... 'String','Frequency (Hz)',... 'Style','text',... 'Tag','text1',... 'UserData',[]); h13 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[4 10.8333333333333 11.5 1.5],... 'String','Amplitude',... 'Style','text',... 'Tag','text3',... 'UserData',[]); h14 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[60.1666666666667 11.0833333333333 13.6666666666667 1.33333333333333],... 'String','Amplitude',... 'Style','text',... 'Tag','text4',... 'UserData',[]); h15 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[4 8.33333333333333 13.5 1.25],... 'String','Phase (deg)',... 'Style','text',... 'Tag','text5',... 'UserData',[]); h16 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[60.1666666666667 8.08333333333333 14 1.41666666666667],... 'String','Phase (deg)',... 'Style','text',... 'Tag','text6',... 'UserData',[]); h17 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[60.1666666666667 13.3333333333333 18.3333333333333 1.83333333333333],... 'String','Frequency (Hz)',... 'Style','text',... 'Tag','text7',... 'UserData',[]); h18 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'FontSize',14,... 'FontWeight','bold',... 'ForegroundColor',[1 0.906591100326115 0],... 'ListboxTop',0,... 'Position',[21.8333333333333 14.0833333333333 5.66666666666667 1.83333333333333],... 'String','1',... 'Style','text',... 'Tag','text8'); h19 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'FontSize',14,... 'FontWeight','bold',... 'ForegroundColor',[1 0.907 0],... 'ListboxTop',0,... 'Position',[77.5 14.0833333333333 5.66666666666667 1.83333333333333],... 'String','2',... 'Style','text',... 'Tag','text9',... 'UserData',[]); h20 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''freq2_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[97.6666666666667 14.0833333333333 12.1666666666667 1.5],... 'String','0',... 'Style','edit',... 'Value',440,... 'CreateFcn','spectrumexpogui(''freq2_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq2'); h21 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.1666666666667 51.9166666666667 100 10],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','sin1',... 'UserData',[]); h22 = get(h21,'title'); set(h22,... 'Parent',h21,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 1.05102040816327 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h23 = get(h21,'xlabel'); set(h23,... 'Parent',h21,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.496598639455782 -0.153061224489796 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h24 = get(h21,'ylabel'); set(h24,... 'Parent',h21,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.195833333333333 0.495833333333333 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h25 = get(h21,'zlabel'); set(h25,... 'Parent',h21,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-1.48979591836735 1.08503401360544 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h26 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''amp2_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[97.6666666666667 11.3333333333333 12.1666666666667 1.5],... 'String','0',... 'Style','edit',... 'CreateFcn','spectrumexpogui(''amp2_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp2'); h27 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''phase2_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[97.8333333333333 8.58333333333333 12.1666666666667 1.5],... 'String','0.0',... 'Style','edit',... 'CreateFcn','spectrumexpogui(''phase2_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase2'); h28 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''freq1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',14.428,... 'Min',4.322,... 'Position',[4 12.8333333333333 50 1],... 'String','8.7814',... 'Style','slider',... 'Value',8.7814,... 'CreateFcn','spectrumexpogui(''freq1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq1slider'); h29 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''amp1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',2,... 'Position',[4 10.25 50 1],... 'String','0.5',... 'Style','slider',... 'Value',0.5,... 'CreateFcn','spectrumexpogui(''amp1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp1slider'); h30 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''phase1slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',180,... 'Min',-180,... 'Position',[4 7.33333333333333 50 1],... 'String','0.0',... 'Style','slider',... 'CreateFcn','spectrumexpogui(''phase1slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase1slider'); h31 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''freq2slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',14.428,... 'Min',4.322,... 'Position',[60 12.8333333333333 50 1],... 'String','0',... 'Style','slider',... 'Value',4.322,... 'CreateFcn','spectrumexpogui(''freq2slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','freq2slider'); h32 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''amp2slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',2,... 'Position',[60 10.25 50 1],... 'String','0',... 'Style','slider',... 'CreateFcn','spectrumexpogui(''amp2slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','amp2slider'); h33 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''phase2slider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Max',180,... 'Min',-180,... 'Position',[60 7.33333333333333 50 1],... 'String','0',... 'Style','slider',... 'CreateFcn','spectrumexpogui(''phase2slider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','phase2slider'); h34 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''offset_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[41.6666666666667 5.75 12.1666666666667 1.5],... 'String','0.0',... 'Style','edit',... 'CreateFcn','spectrumexpogui(''offset_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','offset'); h35 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'CData',[],... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[4 5.5 8 1.33333333333333],... 'String','Offset',... 'Style','text',... 'Tag','text10',... 'UserData',[]); h36 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''offsetslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[4 4.58333333333333 50 1],... 'String','0.0',... 'Style','slider',... 'CreateFcn','spectrumexpogui(''offsetslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','offsetslider'); h37 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''durationtext_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[97.8333333333333 5.25 12.1666666666667 1.5],... 'String','0.01',... 'Style','edit',... 'Value',440,... 'CreateFcn','spectrumexpogui(''durationtext_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','durationtext'); h38 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.9 0.9 0.9],... 'Callback','spectrumexpogui(''durationslider_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Min',0.01,... 'Position',[60 4 50 1],... 'String','0.1',... 'Style','slider',... 'Value',0.01,... 'CreateFcn','spectrumexpogui(''durationslider_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','durationslider'); h39 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'FontSize',18,... 'FontWeight','bold',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[1.66666666666667 0.666666666666667 49.1666666666667 2],... 'String','Spectrum Explorer',... 'Style','text',... 'Tag','text13'); h40 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''gridbox_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[92.5 0.75 11.3333333333333 1.41666666666667],... 'String','Grid',... 'Style','checkbox',... 'Value',1,... 'Tag','gridbox',... 'UserData',[]); h41 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'Callback','spectrumexpogui(''plot1box_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[28.6666666666667 14.0833333333333 11.5 1.5],... 'String','Plot',... 'Style','checkbox',... 'Value',1,... 'Tag','plot1box',... 'UserData',[]); h42 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'BackgroundColor',[0.597913499705588 0.713785514372254 1],... 'Callback','spectrumexpogui(''plot2box_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[84.5 14.0833333333333 11.5 1.5],... 'String','Plot',... 'Style','checkbox',... 'Tag','plot2box',... 'UserData',[]); h43 = uicontrol(... 'Parent',h1,... 'Units','normalized',... 'HorizontalAlignment','left',... 'ListboxTop',0,... 'Position',[0.525622254758419 0.0817941952506596 0.127379209370425 0.0184696569920844],... 'String','Plot Duration',... 'Style','text',... 'Tag','text16'); h44 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''popupmenu1_Callback'',gcbo,[],guidata(gcbo))',... 'CData',[],... 'ListboxTop',0,... 'Position',[64.5 0.75 13.5 1.41666666666667],... 'String',{ 'Sum'; 'Product' },... 'Style','popupmenu',... 'Value',1,... 'CreateFcn','spectrumexpogui(''popupmenu1_CreateFcn'',gcbo,[],guidata(gcbo))',... 'Tag','popupmenu1',... 'UserData',[]); h45 = uimenu(... 'Parent',h1,... 'Callback','spectrumexpogui(''Untitled_1_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Send to...',... 'Tag','Untitled_1'); h46 = uimenu(... 'Parent',h45,... 'Callback','spectrumexpogui(''fourier_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Fourier',... 'Tag','fourier'); h47 = uimenu(... 'Parent',h45,... 'Callback','spectrumexpogui(''sonogram_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Sonogram',... 'Tag','sonogram'); h48 = uimenu(... 'Parent',h45,... 'Callback','spectrumexpogui(''alias_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Aliasing Explorer',... 'Tag','alias'); h49 = uimenu(... 'Parent',h1,... 'Callback','spectrumexpogui(''help_Callback'',gcbo,[],guidata(gcbo))',... 'Label','Help',... 'Tag','help'); h50 = uicontrol(... 'Parent',h1,... 'Units','characters',... 'Callback','spectrumexpogui(''play_Callback'',gcbo,[],guidata(gcbo))',... 'ListboxTop',0,... 'Position',[80.5 0.75 9 1.41666666666667],... 'String','Play',... 'Tag','play'); h51 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.1666666666667 19.4166666666667 100 10],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','phasdomain',... 'UserData',[]); h52 = get(h51,'title'); set(h52,... 'Parent',h51,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.495833333333333 1.0375 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h53 = get(h51,'xlabel'); set(h53,... 'Parent',h51,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.495833333333333 -0.170833333333333 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h54 = get(h51,'ylabel'); set(h54,... 'Parent',h51,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.195833333333333 0.4875 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h55 = get(h51,'zlabel'); set(h55,... 'Parent',h51,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-2.5125 4.3625 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); h56 = axes(... 'Parent',h1,... 'Units','characters',... 'ALim',get(0,'defaultaxesALim'),... 'ALimMode','manual',... 'CameraPosition',[0.5 0.5 9.16025403784439],... 'CameraPositionMode','manual',... 'CameraTarget',[0.5 0.5 0.5],... 'CameraTargetMode','manual',... 'CameraUpVector',[0 1 0],... 'CameraUpVectorMode','manual',... 'CameraViewAngle',6.60861036031192,... 'CameraViewAngleMode','manual',... 'CLim',get(0,'defaultaxesCLim'),... 'CLimMode','manual',... 'Color',get(0,'defaultaxesColor'),... 'ColorOrder',get(0,'defaultaxesColorOrder'),... 'DataAspectRatio',get(0,'defaultaxesDataAspectRatio'),... 'DataAspectRatioMode','manual',... 'PlotBoxAspectRatio',get(0,'defaultaxesPlotBoxAspectRatio'),... 'PlotBoxAspectRatioMode','manual',... 'Position',[10.1666666666667 29.5833333333333 100 10],... 'TickDir',get(0,'defaultaxesTickDir'),... 'TickDirMode','manual',... 'XColor',get(0,'defaultaxesXColor'),... 'XLim',get(0,'defaultaxesXLim'),... 'XLimMode','manual',... 'XTick',[0 0.2 0.4 0.6 0.8 1],... 'XTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'XTickLabelMode','manual',... 'XTickMode','manual',... 'YColor',get(0,'defaultaxesYColor'),... 'YLim',get(0,'defaultaxesYLim'),... 'YLimMode','manual',... 'YTick',[0 0.2 0.4 0.6 0.8 1],... 'YTickLabel',{ '0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 ' },... 'YTickLabelMode','manual',... 'YTickMode','manual',... 'ZColor',get(0,'defaultaxesZColor'),... 'ZLim',get(0,'defaultaxesZLim'),... 'ZLimMode','manual',... 'ZTick',[0 0.5 1],... 'ZTickLabel','',... 'ZTickLabelMode','manual',... 'ZTickMode','manual',... 'Tag','freqdomain',... 'UserData',[]); h57 = get(h56,'title'); set(h57,... 'Parent',h56,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.495833333333333 1.0375 1.00005459937205],... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h58 = get(h56,'xlabel'); set(h58,... 'Parent',h56,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[0.495833333333333 -0.170833333333333 1.00005459937205],... 'VerticalAlignment','cap',... 'HandleVisibility','off'); h59 = get(h56,'ylabel'); set(h59,... 'Parent',h56,... 'Color',[0 0 0],... 'HorizontalAlignment','center',... 'Position',[-0.195833333333333 0.4875 1.00005459937205],... 'Rotation',90,... 'VerticalAlignment','bottom',... 'HandleVisibility','off'); h60 = get(h56,'zlabel'); set(h60,... 'Parent',h56,... 'Color',[0 0 0],... 'HorizontalAlignment','right',... 'Position',[-2.5125 3.34583333333333 1.00005459937205],... 'HandleVisibility','off',... 'Visible','off'); 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 % SPECTRUMEXPOGUI % create the GUI gui_Create = 1; elseif numargin > 3 & ischar(varargin{1}) & ishandle(varargin{2}) % SPECTRUMEXPOGUI('CALLBACK',hObject,eventData,handles,...) gui_Create = 0; else % SPECTRUMEXPOGUI(...) % 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