Home > Source > Callbacks > automation.m

automation

PURPOSE ^

AUTOMATION M-file for automation.fig

SYNOPSIS ^

function varargout = automation(varargin)

DESCRIPTION ^

 AUTOMATION M-file for automation.fig
      AUTOMATION, by itself, creates a new AUTOMATION or raises the existing
      singleton*.

      H = AUTOMATION returns the handle to a new AUTOMATION or the handle to
      the existing singleton*.

      AUTOMATION('CALLBACK',hObject,eventData,handles,...) calls the local
      function named AUTOMATION in AUTOMATION.M with the given input arguments.

      AUTOMATION('Property','Value',...) creates a new AUTOMATION or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before automation_OpeningFunction gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to automation_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

 Code construction assisted by GUIDE

    GENERAL

      Omitted.

    INPUT/S

      -
          
           
    OUTPUT/S

      -

    PENDING WORK

      -

    KNOWN BUG/S

      -

    COMMENT/S

      -

    RELATED FUNCTION/S

      

    ABOUT

      -Created:     March 22nd, 2004
      -Last update: 
      -Revision:    0.0.1
      -Author:      R. S. Schestowitz, University of Manchester
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = automation(varargin)
0002 % AUTOMATION M-file for automation.fig
0003 %      AUTOMATION, by itself, creates a new AUTOMATION or raises the existing
0004 %      singleton*.
0005 %
0006 %      H = AUTOMATION returns the handle to a new AUTOMATION or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      AUTOMATION('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named AUTOMATION in AUTOMATION.M with the given input arguments.
0011 %
0012 %      AUTOMATION('Property','Value',...) creates a new AUTOMATION or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before automation_OpeningFunction gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to automation_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 % Code construction assisted by GUIDE
0022 %
0023 %    GENERAL
0024 %
0025 %      Omitted.
0026 %
0027 %    INPUT/S
0028 %
0029 %      -
0030 %
0031 %
0032 %    OUTPUT/S
0033 %
0034 %      -
0035 %
0036 %    PENDING WORK
0037 %
0038 %      -
0039 %
0040 %    KNOWN BUG/S
0041 %
0042 %      -
0043 %
0044 %    COMMENT/S
0045 %
0046 %      -
0047 %
0048 %    RELATED FUNCTION/S
0049 %
0050 %
0051 %
0052 %    ABOUT
0053 %
0054 %      -Created:     March 22nd, 2004
0055 %      -Last update:
0056 %      -Revision:    0.0.1
0057 %      -Author:      R. S. Schestowitz, University of Manchester
0058 % ==============================================================
0059 
0060 % Edit the above text to modify the response to help_button register
0061 
0062 % Last Modified by GUIDE v2.5 25-Mar-2004 04:20:47
0063 
0064 % Begin initialization code - DO NOT EDIT
0065 gui_Singleton = 1;
0066 gui_State = struct('gui_Name',       mfilename, ...
0067     'gui_Singleton',  gui_Singleton, ...
0068     'gui_OpeningFcn', @automation_OpeningFcn, ...
0069     'gui_OutputFcn',  @automation_OutputFcn, ...
0070     'gui_LayoutFcn',  [] , ...
0071     'gui_Callback',   []);
0072 if nargin & isstr(varargin{1})
0073     gui_State.gui_Callback = str2func(varargin{1});
0074 end
0075 
0076 if nargout
0077     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0078 else
0079     gui_mainfcn(gui_State, varargin{:});
0080 end
0081 % End initialization code - DO NOT EDIT
0082 
0083 % --- Executes just before register is made visible.
0084 function automation_OpeningFcn(hObject, eventdata, handles, varargin)
0085 % This function has no output args, see OutputFcn.
0086 % hObject    handle to figure
0087 % eventdata  reserved - to be defined in a future version of MATLAB
0088 % handles    structure with handles and user data (see GUIDATA)
0089 % varargin   command line arguments to register (see VARARGIN)
0090 
0091 % Choose default command line output for register
0092 handles.output = hObject;
0093 
0094 % Update handles structure
0095 guidata(hObject, handles);
0096 
0097 if strcmp(get(hObject,'Visible'),'off')
0098     initialize_gui(hObject, handles);
0099 end
0100 
0101 % UIWAIT makes register pause for user response (see UIRESUME)
0102 % uiwait(handles.Advanced_window);
0103 
0104 
0105 % --- Outputs from this function are returned to the command line.
0106 function varargout = automation_OutputFcn(hObject, eventdata, handles)
0107 % varargout  cell array for returning output args (see VARARGOUT);
0108 % hObject    handle to figure
0109 % eventdata  reserved - to be defined in a future version of MATLAB
0110 % handles    structure with handles and user data (see GUIDATA)
0111 
0112 % Get default command line output from handles structure
0113 varargout{1} = handles.output;
0114 
0115 
0116 
0117 function initialize_gui(fig_handle, handles)
0118 
0119 set(handles.minimum_value, 'String', getappdata(0, 'minimum_value'));
0120 set(handles.minimum_slider, 'Value', str2num(get(handles.minimum_value, 'String')));
0121 
0122 set(handles.maximum_value, 'String', getappdata(0, 'maximum_value'));
0123 set(handles.maximum_slider, 'Value', str2num(get(handles.maximum_value, 'String')));
0124 
0125 set(handles.step_size, 'String', getappdata(0, 'step_size'));
0126 set(handles.step_slider, 'Value', str2num(get(handles.step_size, 'String')));
0127 
0128 set(handles.automation_type_parameter, 'String', getappdata(0, 'automation_type'));
0129 
0130 background = imread('background.jpg');
0131 
0132 axes(handles.background);
0133 axis off;
0134 imshow(background,[0,255]);
0135 
0136 % --- Executes on button press in ok_botton.
0137 function ok_botton_Callback(hObject, eventdata, handles)
0138 % hObject    handle to ok_botton (see GCBO)
0139 % eventdata  reserved - to be defined in a future version of MATLAB
0140 % handles    structure with handles and user data (see GUIDATA)
0141 
0142 
0143 setappdata(0, 'minimum_value', get(handles.minimum_value, 'String'));
0144 setappdata(0, 'maximum_value', get(handles.maximum_value, 'String'));
0145 setappdata(0, 'step_size', get(handles.step_size, 'String'));
0146 setappdata(0, 'automation_type', get(handles.automation_type_parameter, 'String'));
0147 close;
0148 
0149 
0150 
0151 % --- Executes on button press in cancel_button.
0152 function cancel_button_Callback(hObject, eventdata, handles)
0153 % hObject    handle to cancel_button (see GCBO)
0154 % eventdata  reserved - to be defined in a future version of MATLAB
0155 % handles    structure with handles and user data (see GUIDATA)
0156 close;
0157 
0158 % --- Executes on button press in apply_button.
0159 function apply_button_Callback(hObject, eventdata, handles)
0160 % hObject    handle to apply_button (see GCBO)
0161 % eventdata  reserved - to be defined in a future version of MATLAB
0162 % handles    structure with handles and user data (see GUIDATA)
0163 
0164 setappdata(0, 'minimum_value', get(handles.minimum_value, 'String'));
0165 setappdata(0, 'maximum_value', get(handles.maximum_value, 'String'));
0166 setappdata(0, 'step_size', get(handles.step_size, 'String'));
0167 setappdata(0, 'automation_type', get(handles.automation_type_parameter, 'String'));
0168 
0169 
0170 
0171 
0172 % --- Executes during object creation, after setting all properties.
0173 function step_slider_CreateFcn(hObject, eventdata, handles)
0174 % hObject    handle to step_slider (see GCBO)
0175 % eventdata  reserved - to be defined in a future version of MATLAB
0176 % handles    empty - handles not created until after all CreateFcns called
0177 
0178 % Hint: slider controls usually have a light gray background, change
0179 %       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
0180 usewhitebg = 1;
0181 if usewhitebg
0182     set(hObject,'BackgroundColor',[.9 .9 .9]);
0183 else
0184     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0185 end
0186 
0187 
0188 % --- Executes on slider movement.
0189 function step_slider_Callback(hObject, eventdata, handles)
0190 % hObject    handle to step_slider (see GCBO)
0191 % eventdata  reserved - to be defined in a future version of MATLAB
0192 % handles    structure with handles and user data (see GUIDATA)
0193 
0194 % Hints: get(hObject,'Value') returns position of slider
0195 %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
0196 
0197 set(handles.step_size, 'String', num2str(ceil(get(handles.step_slider, 'Value'))));
0198 
0199 % --- Executes during object creation, after setting all properties.
0200 function maximum_slider_CreateFcn(hObject, eventdata, handles)
0201 % hObject    handle to maximum_slider (see GCBO)
0202 % eventdata  reserved - to be defined in a future version of MATLAB
0203 % handles    empty - handles not created until after all CreateFcns called
0204 
0205 % Hint: slider controls usually have a light gray background, change
0206 %       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
0207 usewhitebg = 1;
0208 if usewhitebg
0209     set(hObject,'BackgroundColor',[.9 .9 .9]);
0210 else
0211     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0212 end
0213 
0214 
0215 % --- Executes on slider movement.
0216 function maximum_slider_Callback(hObject, eventdata, handles)
0217 % hObject    handle to maximum_slider (see GCBO)
0218 % eventdata  reserved - to be defined in a future version of MATLAB
0219 % handles    structure with handles and user data (see GUIDATA)
0220 
0221 % Hints: get(hObject,'Value') returns position of slider
0222 %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
0223 
0224 set(handles.maximum_value, 'String', num2str(ceil(get(handles.maximum_slider, 'Value'))));
0225 
0226 
0227 
0228 % --- Executes during object creation, after setting all properties.
0229 function automation_menu_CreateFcn(hObject, eventdata, handles)
0230 % hObject    handle to automation_menu (see GCBO)
0231 % eventdata  reserved - to be defined in a future version of MATLAB
0232 % handles    empty - handles not created until after all CreateFcns called
0233 
0234 % Hint: popupmenu controls usually have a white background on Windows.
0235 %       See ISPC and COMPUTER.
0236 if ispc
0237     set(hObject,'BackgroundColor','white');
0238 else
0239     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0240 end
0241 
0242 
0243 % --- Executes on selection change in automation_menu.
0244 function automation_menu_Callback(hObject, eventdata, handles)
0245 % hObject    handle to automation_menu (see GCBO)
0246 % eventdata  reserved - to be defined in a future version of MATLAB
0247 % handles    structure with handles and user data (see GUIDATA)
0248 
0249 % Hints: contents = get(hObject,'String') returns automation_menu contents as cell array
0250 %        contents{get(hObject,'Value')} returns selected item from automation_menu
0251 
0252 
0253 contents = get(hObject,'String');
0254 
0255 if (strcmp(contents{get(hObject,'Value')},'Number of Knot-points')),
0256        set(handles.automation_type_parameter, 'String', 'Number of Knot-points');  
0257 elseif (strcmp(contents{get(hObject,'Value')},'Number of Modes')),
0258        set(handles.automation_type_parameter, 'String', 'Number of Modes');  
0259 elseif (strcmp(contents{get(hObject,'Value')},'Model Weight')),
0260        set(handles.automation_type_parameter, 'String', 'Model Weight'); 
0261 elseif (strcmp(contents{get(hObject,'Value')},'Smoothing')),
0262        set(handles.automation_type_parameter, 'String', 'Smoothing'); 
0263 elseif (strcmp(contents{get(hObject,'Value')},'Perturbation')),
0264        set(handles.automation_type_parameter, 'String', 'Perturbation');            
0265 elseif (strcmp(contents{get(hObject,'Value')},'None')),
0266        set(handles.automation_type_parameter, 'String', 'None');       
0267 else
0268     error('Wrong values passed from automation type menu. Internal error.');
0269 end
0270 
0271 
0272 
0273 
0274 % --- Executes during object creation, after setting all properties.
0275 function minimum_slider_CreateFcn(hObject, eventdata, handles)
0276 % hObject    handle to minimum_slider (see GCBO)
0277 % eventdata  reserved - to be defined in a future version of MATLAB
0278 % handles    empty - handles not created until after all CreateFcns called
0279 
0280 % Hint: slider controls usually have a light gray background, change
0281 %       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
0282 usewhitebg = 1;
0283 if usewhitebg
0284     set(hObject,'BackgroundColor',[.9 .9 .9]);
0285 else
0286     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0287 end
0288 
0289 
0290 % --- Executes on slider movement.
0291 function minimum_slider_Callback(hObject, eventdata, handles)
0292 % hObject    handle to minimum_slider (see GCBO)
0293 % eventdata  reserved - to be defined in a future version of MATLAB
0294 % handles    structure with handles and user data (see GUIDATA)
0295 
0296 % Hints: get(hObject,'Value') returns position of slider
0297 %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
0298 
0299 
0300 
0301 set(handles.minimum_value, 'String', num2str(ceil(get(handles.minimum_slider, 'Value'))));

Generated on Fri 14-May-2004 10:05:30 by m2html © 2003