lfgui.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. function varargout = lfgui(varargin)
  2. % LFGUI M-file for lfgui.fig
  3. % LFGUI, by itself, creates a new LFGUI or raises the existing
  4. % singleton*.
  5. %
  6. % H = LFGUI returns the handle to a new LFGUI or the handle to
  7. % the existing singleton*.
  8. %
  9. % LFGUI('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in LFGUI.M with the given input arguments.
  11. %
  12. % LFGUI('Property','Value',...) creates a new LFGUI or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before lfgui_OpeningFunction gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to lfgui_OpeningFcn via varargin.
  17. %
  18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  19. % instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22. % Copyright 2002-2003 The MathWorks, Inc.
  23. % Edit the above text to modify the response to help lfgui
  24. % Last Modified by GUIDE v2.5 27-Dec-2005 18:56:48
  25. % Begin initialization code - DO NOT EDIT
  26. gui_Singleton = 1;
  27. gui_State = struct('gui_Name', mfilename, ...
  28. 'gui_Singleton', gui_Singleton, ...
  29. 'gui_OpeningFcn', @lfgui_OpeningFcn, ...
  30. 'gui_OutputFcn', @lfgui_OutputFcn, ...
  31. 'gui_LayoutFcn', [] , ...
  32. 'gui_Callback', []);
  33. if nargin && ischar(varargin{1})
  34. gui_State.gui_Callback = str2func(varargin{1});
  35. end
  36. if nargout
  37. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  38. else
  39. gui_mainfcn(gui_State, varargin{:});
  40. end
  41. % End initialization code - DO NOT EDIT
  42. % --- Executes just before lfgui is made visible.
  43. function lfgui_OpeningFcn(hObject, eventdata, handles, varargin)
  44. % This function has no output args, see OutputFcn.
  45. % hObject handle to figure
  46. % eventdata reserved - to be defined in a future version of MATLAB
  47. % handles structure with handles and user data (see GUIDATA)
  48. % varargin command line arguments to lfgui (see VARARGIN)
  49. fit = locfit(varargin{:});
  50. lfplot(fit);
  51. handles.lfargs = varargin;
  52. % Choose default command line output for lfgui
  53. handles.output = hObject;
  54. % Update handles structure
  55. guidata(hObject, handles);
  56. % UIWAIT makes lfgui wait for user response (see UIRESUME)
  57. % uiwait(handles.figure1);
  58. % --- Outputs from this function are returned to the command line.
  59. function varargout = lfgui_OutputFcn(hObject, eventdata, handles)
  60. % varargout cell array for returning output args (see VARARGOUT);
  61. % hObject handle to figure
  62. % eventdata reserved - to be defined in a future version of MATLAB
  63. % handles structure with handles and user data (see GUIDATA)
  64. % Get default command line output from handles structure
  65. varargout{1} = handles.output;
  66. % --- Executes on slider movement.
  67. function slider1_Callback(hObject, eventdata, handles)
  68. % hObject handle to slider1 (see GCBO)
  69. % eventdata reserved - to be defined in a future version of MATLAB
  70. % handles structure with handles and user data (see GUIDATA)
  71. % Hints: get(hObject,'Value') returns position of slider
  72. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  73. n = get(hObject,'Value');
  74. n0 = get(hObject,'Min');
  75. n1 = get(hObject,'Max');
  76. nn = 0.1+(n-n0)/(n1-n0);
  77. fit = locfit(handles.lfargs{:},'nn',nn);
  78. lfplot(fit);
  79. % --- Executes during object creation, after setting all properties.
  80. function slider1_CreateFcn(hObject, eventdata, handles)
  81. % hObject handle to slider1 (see GCBO)
  82. % eventdata reserved - to be defined in a future version of MATLAB
  83. % handles empty - handles not created until after all CreateFcns called
  84. % Hint: slider controls usually have a light gray background, change
  85. % 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
  86. usewhitebg = 1;
  87. if usewhitebg
  88. set(hObject,'BackgroundColor',[.9 .9 .9]);
  89. else
  90. set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
  91. end