LFGUI M-file for lfgui.fig LFGUI, by itself, creates a new LFGUI or raises the existing singleton*. H = LFGUI returns the handle to a new LFGUI or the handle to the existing singleton*. LFGUI('CALLBACK',hObject,eventData,handles,...) calls the local function named CALLBACK in LFGUI.M with the given input arguments. LFGUI('Property','Value',...) creates a new LFGUI or raises the existing singleton*. Starting from the left, property value pairs are applied to the GUI before lfgui_OpeningFunction gets called. An unrecognized property name or invalid value makes property application stop. All inputs are passed to lfgui_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
0001 function varargout = lfgui(varargin) 0002 % LFGUI M-file for lfgui.fig 0003 % LFGUI, by itself, creates a new LFGUI or raises the existing 0004 % singleton*. 0005 % 0006 % H = LFGUI returns the handle to a new LFGUI or the handle to 0007 % the existing singleton*. 0008 % 0009 % LFGUI('CALLBACK',hObject,eventData,handles,...) calls the local 0010 % function named CALLBACK in LFGUI.M with the given input arguments. 0011 % 0012 % LFGUI('Property','Value',...) creates a new LFGUI or raises the 0013 % existing singleton*. Starting from the left, property value pairs are 0014 % applied to the GUI before lfgui_OpeningFunction gets called. An 0015 % unrecognized property name or invalid value makes property application 0016 % stop. All inputs are passed to lfgui_OpeningFcn via varargin. 0017 % 0018 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 0019 % instance to run (singleton)". 0020 % 0021 % See also: GUIDE, GUIDATA, GUIHANDLES 0022 0023 % Copyright 2002-2003 The MathWorks, Inc. 0024 0025 % Edit the above text to modify the response to help lfgui 0026 0027 % Last Modified by GUIDE v2.5 27-Dec-2005 18:56:48 0028 0029 % Begin initialization code - DO NOT EDIT 0030 gui_Singleton = 1; 0031 gui_State = struct('gui_Name', mfilename, ... 0032 'gui_Singleton', gui_Singleton, ... 0033 'gui_OpeningFcn', @lfgui_OpeningFcn, ... 0034 'gui_OutputFcn', @lfgui_OutputFcn, ... 0035 'gui_LayoutFcn', [] , ... 0036 'gui_Callback', []); 0037 if nargin && ischar(varargin{1}) 0038 gui_State.gui_Callback = str2func(varargin{1}); 0039 end 0040 0041 if nargout 0042 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 0043 else 0044 gui_mainfcn(gui_State, varargin{:}); 0045 end 0046 % End initialization code - DO NOT EDIT 0047 0048 0049 % --- Executes just before lfgui is made visible. 0050 function lfgui_OpeningFcn(hObject, eventdata, handles, varargin) 0051 % This function has no output args, see OutputFcn. 0052 % hObject handle to figure 0053 % eventdata reserved - to be defined in a future version of MATLAB 0054 % handles structure with handles and user data (see GUIDATA) 0055 % varargin command line arguments to lfgui (see VARARGIN) 0056 0057 fit = locfit(varargin{:}); 0058 lfplot(fit); 0059 handles.lfargs = varargin; 0060 0061 % Choose default command line output for lfgui 0062 handles.output = hObject; 0063 0064 % Update handles structure 0065 guidata(hObject, handles); 0066 0067 % UIWAIT makes lfgui wait for user response (see UIRESUME) 0068 % uiwait(handles.figure1); 0069 0070 0071 % --- Outputs from this function are returned to the command line. 0072 function varargout = lfgui_OutputFcn(hObject, eventdata, handles) 0073 % varargout cell array for returning output args (see VARARGOUT); 0074 % hObject handle to figure 0075 % eventdata reserved - to be defined in a future version of MATLAB 0076 % handles structure with handles and user data (see GUIDATA) 0077 0078 % Get default command line output from handles structure 0079 varargout{1} = handles.output; 0080 0081 0082 % --- Executes on slider movement. 0083 function slider1_Callback(hObject, eventdata, handles) 0084 % hObject handle to slider1 (see GCBO) 0085 % eventdata reserved - to be defined in a future version of MATLAB 0086 % handles structure with handles and user data (see GUIDATA) 0087 0088 % Hints: get(hObject,'Value') returns position of slider 0089 % get(hObject,'Min') and get(hObject,'Max') to determine range of slider 0090 0091 n = get(hObject,'Value'); 0092 n0 = get(hObject,'Min'); 0093 n1 = get(hObject,'Max'); 0094 nn = 0.1+(n-n0)/(n1-n0); 0095 fit = locfit(handles.lfargs{:},'nn',nn); 0096 lfplot(fit); 0097 0098 % --- Executes during object creation, after setting all properties. 0099 function slider1_CreateFcn(hObject, eventdata, handles) 0100 % hObject handle to slider1 (see GCBO) 0101 % eventdata reserved - to be defined in a future version of MATLAB 0102 % handles empty - handles not created until after all CreateFcns called 0103 0104 % Hint: slider controls usually have a light gray background, change 0105 % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER. 0106 usewhitebg = 1; 0107 if usewhitebg 0108 set(hObject,'BackgroundColor',[.9 .9 .9]); 0109 else 0110 set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); 0111 end 0112 0113