Home > chronux > wave_browser > configure_classify.m

configure_classify

PURPOSE ^

CONFIGURE_CLASSIFY M-file for configure_classify.fig

SYNOPSIS ^

function varargout = configure_classify(varargin)

DESCRIPTION ^

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

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

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

      CONFIGURE_CLASSIFY('Property','Value',...) creates a new CONFIGURE_CLASSIFY or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before configure_classify_OpeningFunction gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to configure_classify_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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = configure_classify(varargin)
0002 % CONFIGURE_CLASSIFY M-file for configure_classify.fig
0003 %      CONFIGURE_CLASSIFY, by itself, creates a new CONFIGURE_CLASSIFY or raises the existing
0004 %      singleton*.
0005 %
0006 %      H = CONFIGURE_CLASSIFY returns the handle to a new CONFIGURE_CLASSIFY or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      CONFIGURE_CLASSIFY('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named CALLBACK in CONFIGURE_CLASSIFY.M with the given input arguments.
0011 %
0012 %      CONFIGURE_CLASSIFY('Property','Value',...) creates a new CONFIGURE_CLASSIFY or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before configure_classify_OpeningFunction gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to configure_classify_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 configure_classify
0026 
0027 % Last Modified by GUIDE v2.5 01-May-2006 23:22:44
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', @configure_classify_OpeningFcn, ...
0034                    'gui_OutputFcn',  @configure_classify_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 configure_classify is made visible.
0050 function configure_classify_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 configure_classify (see VARARGIN)
0056 
0057 
0058 % Choose default command line output for configure_classify
0059 handles.output = hObject;
0060 
0061 % Update handles structure
0062 guidata(hObject, handles);
0063 
0064 % UIWAIT makes configure_classify wait for user response (see UIRESUME)
0065 % uiwait(handles.figure1);
0066 % configure_classify(0,7500,400,500,44100,[0.01 0.001],[3 5],[0 20000])
0067 
0068 handles.lowerfreq = varargin{1};  % Lower frequency for zooming
0069 handles.upperfreq = varargin{2}; % Upper frequency for zooming
0070 
0071 handles.classified_height = varargin{3} ; % the height of the image in the classified axes
0072 handles.classified_width = varargin{4};  % the width of the image in the classified axes
0073 
0074 handles.Fs = varargin{5}; % Frequency of audio sampling per second
0075 handles.movingwin = varargin{6}; % Size of the moving window in seconds; the first number is the window size and the second is the step size
0076 handles.tapers = varargin{7}; % Tapers for smoothing
0077 handles.fpass = varargin{8}; % Range of frequency sampling
0078 
0079 handles.fixed = varargin{9}; % Fixed scaling of the classified axes
0080 
0081 set(handles.ZoomLowerFreq,'String',num2str(handles.lowerfreq));
0082 set(handles.ZoomUpperFreq,'String',num2str(handles.upperfreq));
0083 set(handles.ClassifiedWidth,'String',num2str(handles.classified_width));
0084 set(handles.ClassifiedHeight,'String',num2str(handles.classified_height));
0085 set(handles.Frequency,'String',num2str(handles.Fs));
0086 set(handles.WinSize,'String',num2str(handles.movingwin(1) * 1000));
0087 set(handles.StepSize,'String',num2str(handles.movingwin(2) * 1000));
0088 set(handles.TW,'String',num2str(handles.tapers(1)));
0089 set(handles.MinFreq,'String',num2str(handles.fpass(1)));
0090 set(handles.MaxFreq,'String',num2str(handles.fpass(2)));
0091 
0092 set(handles.FixedCheckbox,'Value',handles.fixed);
0093 
0094 % set(handles.ZoomLowerFreq,'Enable','off');
0095 % set(handles.ZoomUpperFreq,'Enable','off');
0096 % set(handles.ClassifiedWidth,'Enable','off');
0097 % set(handles.ClassifiedHeight,'Enable','off');
0098 % set(handles.Frequency,'Enable','off');
0099 % set(handles.WinSize,'Enable','off');
0100 % set(handles.StepSize,'Enable','off');
0101 % set(handles.TW,'Enable','off');
0102 % set(handles.MinFreq,'Enable','off');
0103 % set(handles.MaxFreq,'Enable','off');
0104 
0105 uiwait(handles.figure1);
0106 
0107 
0108 % --- Outputs from this function are returned to the command line.
0109 function varargout = configure_classify_OutputFcn(hObject, eventdata, handles) 
0110 % varargout  cell array for returning output args (see VARARGOUT);
0111 % hObject    handle to figure
0112 % eventdata  reserved - to be defined in a future version of MATLAB
0113 % handles    structure with handles and user data (see GUIDATA)
0114 
0115 % Get default command line output from handles structure
0116 varargout{1} = handles.output;
0117 
0118 close;
0119 
0120 function WinSize_Callback(hObject, eventdata, handles)
0121 % hObject    handle to WinSize (see GCBO)
0122 % eventdata  reserved - to be defined in a future version of MATLAB
0123 % handles    structure with handles and user data (see GUIDATA)
0124 
0125 % Hints: get(hObject,'String') returns contents of WinSize as text
0126 %        str2double(get(hObject,'String')) returns contents of WinSize as a double
0127 
0128 
0129 % --- Executes during object creation, after setting all properties.
0130 function WinSize_CreateFcn(hObject, eventdata, handles)
0131 % hObject    handle to WinSize (see GCBO)
0132 % eventdata  reserved - to be defined in a future version of MATLAB
0133 % handles    empty - handles not created until after all CreateFcns called
0134 
0135 % Hint: edit controls usually have a white background on Windows.
0136 %       See ISPC and COMPUTER.
0137 if ispc
0138     set(hObject,'BackgroundColor','white');
0139 else
0140     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0141 end
0142 
0143 
0144 % --- Executes on button press in OKButton.
0145 function OKButton_Callback(hObject, eventdata, handles)
0146 % hObject    handle to OKButton (see GCBO)
0147 % eventdata  reserved - to be defined in a future version of MATLAB
0148 % handles    structure with handles and user data (see GUIDATA)
0149 
0150 lowerfreq = str2num(get(handles.ZoomLowerFreq,'String'));  % Lower frequency for zooming
0151 upperfreq = str2num(get(handles.ZoomUpperFreq,'String')); % Upper frequency for zooming
0152 
0153 classified_height = str2num(get(handles.ClassifiedHeight,'String')); % the height of the image in the classified axes
0154 classified_width = str2num(get(handles.ClassifiedWidth,'String'));  % the width of the image in the classified axes
0155 
0156 Fs = str2num(get(handles.Frequency,'String')); % Frequency of audio sampling per second
0157 
0158 winsizeS = str2num(get(handles.WinSize,'String')) / 1000;
0159 stepS = str2num(get(handles.StepSize,'String')) / 1000;
0160 movingwin = [winsizeS stepS]; % Size of the moving window in seconds; the first number is the window size and the second is the step size
0161 
0162 tw = str2num(get(handles.TW,'String'));
0163 
0164 fpasslower = str2num(get(handles.MinFreq,'String')); % Range of frequency sampling
0165 fpassupper = str2num(get(handles.MaxFreq,'String'));
0166 fpass = [fpasslower fpassupper];
0167 
0168 ierror = 1; % Indicates no errors encountered
0169 
0170 if isempty(classified_height) || (classified_height < 1)
0171     ierror = 0;
0172 end
0173     
0174 if isempty(tw) || tw < 0
0175     ierror = 0;
0176 end
0177 
0178 if isempty(lowerfreq) || lowerfreq < 0
0179     ierror = 0;
0180 end
0181 
0182 if isempty(fpasslower) || fpasslower < 0
0183     ierror = 0;
0184 end
0185 
0186 if isempty(fpassupper) || fpassupper < fpasslower
0187     ierror = 0;
0188 end
0189 
0190 if isempty(upperfreq) || lowerfreq > upperfreq 
0191     ierror = 0;
0192 end
0193 
0194 if isempty(winsizeS) || winsizeS < 0
0195     ierror = 0;
0196 end
0197 
0198 if isempty(stepS) || stepS < 0
0199     ierror = 0
0200 end
0201 
0202 if isempty(tw) || tw < 0
0203     ierror = 0
0204 else
0205     tapers = [tw,floor(2*tw-1)]; % Tapers for smoothing
0206 end
0207 
0208 fixed = get(handles.FixedCheckbox,'Value');
0209 
0210 if ierror == 0
0211     ;
0212 else
0213     handles.output = {lowerfreq,upperfreq,classified_height,classified_width,Fs,movingwin,tapers,fpass,fixed};
0214     guidata(hObject,handles);
0215     uiresume(handles.figure1);
0216 end
0217 
0218 
0219 %uiresume;
0220 %close;
0221 
0222 % --- Executes on button press in CancelButton.
0223 function CancelButton_Callback(hObject, eventdata, handles)
0224 % hObject    handle to CancelButton (see GCBO)
0225 % eventdata  reserved - to be defined in a future version of MATLAB
0226 % handles    structure with handles and user data (see GUIDATA)
0227 
0228 handles.output = 0;
0229 guidata(hObject,handles);
0230 uiresume(handles.figure1);
0231 
0232 function StepSize_Callback(hObject, eventdata, handles)
0233 % hObject    handle to StepSize (see GCBO)
0234 % eventdata  reserved - to be defined in a future version of MATLAB
0235 % handles    structure with handles and user data (see GUIDATA)
0236 
0237 % Hints: get(hObject,'String') returns contents of StepSize as text
0238 %        str2double(get(hObject,'String')) returns contents of StepSize as a double
0239 
0240 
0241 % --- Executes during object creation, after setting all properties.
0242 function StepSize_CreateFcn(hObject, eventdata, handles)
0243 % hObject    handle to StepSize (see GCBO)
0244 % eventdata  reserved - to be defined in a future version of MATLAB
0245 % handles    empty - handles not created until after all CreateFcns called
0246 
0247 % Hint: edit controls usually have a white background on Windows.
0248 %       See ISPC and COMPUTER.
0249 if ispc
0250     set(hObject,'BackgroundColor','white');
0251 else
0252     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0253 end
0254 
0255 
0256 
0257 function TW_Callback(hObject, eventdata, handles)
0258 % hObject    handle to TW (see GCBO)
0259 % eventdata  reserved - to be defined in a future version of MATLAB
0260 % handles    structure with handles and user data (see GUIDATA)
0261 
0262 % Hints: get(hObject,'String') returns contents of TW as text
0263 %        str2double(get(hObject,'String')) returns contents of TW as a double
0264 
0265 
0266 % --- Executes during object creation, after setting all properties.
0267 function TW_CreateFcn(hObject, eventdata, handles)
0268 % hObject    handle to TW (see GCBO)
0269 % eventdata  reserved - to be defined in a future version of MATLAB
0270 % handles    empty - handles not created until after all CreateFcns called
0271 
0272 % Hint: edit controls usually have a white background on Windows.
0273 %       See ISPC and COMPUTER.
0274 if ispc
0275     set(hObject,'BackgroundColor','white');
0276 else
0277     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0278 end
0279 
0280 
0281 
0282 function MinFreq_Callback(hObject, eventdata, handles)
0283 % hObject    handle to MinFreq (see GCBO)
0284 % eventdata  reserved - to be defined in a future version of MATLAB
0285 % handles    structure with handles and user data (see GUIDATA)
0286 
0287 % Hints: get(hObject,'String') returns contents of MinFreq as text
0288 %        str2double(get(hObject,'String')) returns contents of MinFreq as a double
0289 
0290 
0291 % --- Executes during object creation, after setting all properties.
0292 function MinFreq_CreateFcn(hObject, eventdata, handles)
0293 % hObject    handle to MinFreq (see GCBO)
0294 % eventdata  reserved - to be defined in a future version of MATLAB
0295 % handles    empty - handles not created until after all CreateFcns called
0296 
0297 % Hint: edit controls usually have a white background on Windows.
0298 %       See ISPC and COMPUTER.
0299 if ispc
0300     set(hObject,'BackgroundColor','white');
0301 else
0302     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0303 end
0304 
0305 
0306 
0307 function MaxFreq_Callback(hObject, eventdata, handles)
0308 % hObject    handle to MaxFreq (see GCBO)
0309 % eventdata  reserved - to be defined in a future version of MATLAB
0310 % handles    structure with handles and user data (see GUIDATA)
0311 
0312 % Hints: get(hObject,'String') returns contents of MaxFreq as text
0313 %        str2double(get(hObject,'String')) returns contents of MaxFreq as a double
0314 
0315 
0316 % --- Executes during object creation, after setting all properties.
0317 function MaxFreq_CreateFcn(hObject, eventdata, handles)
0318 % hObject    handle to MaxFreq (see GCBO)
0319 % eventdata  reserved - to be defined in a future version of MATLAB
0320 % handles    empty - handles not created until after all CreateFcns called
0321 
0322 % Hint: edit controls usually have a white background on Windows.
0323 %       See ISPC and COMPUTER.
0324 if ispc
0325     set(hObject,'BackgroundColor','white');
0326 else
0327     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0328 end
0329 
0330 
0331 
0332 function ZoomLowerFreq_Callback(hObject, eventdata, handles)
0333 % hObject    handle to ZoomLowerFreq (see GCBO)
0334 % eventdata  reserved - to be defined in a future version of MATLAB
0335 % handles    structure with handles and user data (see GUIDATA)
0336 
0337 % Hints: get(hObject,'String') returns contents of ZoomLowerFreq as text
0338 %        str2double(get(hObject,'String')) returns contents of ZoomLowerFreq as a double
0339 
0340 
0341 % --- Executes during object creation, after setting all properties.
0342 function ZoomLowerFreq_CreateFcn(hObject, eventdata, handles)
0343 % hObject    handle to ZoomLowerFreq (see GCBO)
0344 % eventdata  reserved - to be defined in a future version of MATLAB
0345 % handles    empty - handles not created until after all CreateFcns called
0346 
0347 % Hint: edit controls usually have a white background on Windows.
0348 %       See ISPC and COMPUTER.
0349 if ispc
0350     set(hObject,'BackgroundColor','white');
0351 else
0352     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0353 end
0354 
0355 
0356 
0357 function ZoomUpperFreq_Callback(hObject, eventdata, handles)
0358 % hObject    handle to ZoomUpperFreq (see GCBO)
0359 % eventdata  reserved - to be defined in a future version of MATLAB
0360 % handles    structure with handles and user data (see GUIDATA)
0361 
0362 % Hints: get(hObject,'String') returns contents of ZoomUpperFreq as text
0363 %        str2double(get(hObject,'String')) returns contents of ZoomUpperFreq as a double
0364 
0365 
0366 % --- Executes during object creation, after setting all properties.
0367 function ZoomUpperFreq_CreateFcn(hObject, eventdata, handles)
0368 % hObject    handle to ZoomUpperFreq (see GCBO)
0369 % eventdata  reserved - to be defined in a future version of MATLAB
0370 % handles    empty - handles not created until after all CreateFcns called
0371 
0372 % Hint: edit controls usually have a white background on Windows.
0373 %       See ISPC and COMPUTER.
0374 if ispc
0375     set(hObject,'BackgroundColor','white');
0376 else
0377     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0378 end
0379 
0380 
0381 
0382 function ClassifiedWidth_Callback(hObject, eventdata, handles)
0383 % hObject    handle to ClassifiedWidth (see GCBO)
0384 % eventdata  reserved - to be defined in a future version of MATLAB
0385 % handles    structure with handles and user data (see GUIDATA)
0386 
0387 % Hints: get(hObject,'String') returns contents of ClassifiedWidth as text
0388 %        str2double(get(hObject,'String')) returns contents of ClassifiedWidth as a double
0389 
0390 
0391 % --- Executes during object creation, after setting all properties.
0392 function ClassifiedWidth_CreateFcn(hObject, eventdata, handles)
0393 % hObject    handle to ClassifiedWidth (see GCBO)
0394 % eventdata  reserved - to be defined in a future version of MATLAB
0395 % handles    empty - handles not created until after all CreateFcns called
0396 
0397 % Hint: edit controls usually have a white background on Windows.
0398 %       See ISPC and COMPUTER.
0399 if ispc
0400     set(hObject,'BackgroundColor','white');
0401 else
0402     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0403 end
0404 
0405 
0406 
0407 function ClassifiedHeight_Callback(hObject, eventdata, handles)
0408 % hObject    handle to ClassifiedHeight (see GCBO)
0409 % eventdata  reserved - to be defined in a future version of MATLAB
0410 % handles    structure with handles and user data (see GUIDATA)
0411 
0412 % Hints: get(hObject,'String') returns contents of ClassifiedHeight as text
0413 %        str2double(get(hObject,'String')) returns contents of ClassifiedHeight as a double
0414 
0415 
0416 % --- Executes during object creation, after setting all properties.
0417 function ClassifiedHeight_CreateFcn(hObject, eventdata, handles)
0418 % hObject    handle to ClassifiedHeight (see GCBO)
0419 % eventdata  reserved - to be defined in a future version of MATLAB
0420 % handles    empty - handles not created until after all CreateFcns called
0421 
0422 % Hint: edit controls usually have a white background on Windows.
0423 %       See ISPC and COMPUTER.
0424 if ispc
0425     set(hObject,'BackgroundColor','white');
0426 else
0427     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0428 end
0429 
0430 
0431 
0432 
0433 
0434 function Frequency_Callback(hObject, eventdata, handles)
0435 % hObject    handle to Frequency (see GCBO)
0436 % eventdata  reserved - to be defined in a future version of MATLAB
0437 % handles    structure with handles and user data (see GUIDATA)
0438 
0439 % Hints: get(hObject,'String') returns contents of Frequency as text
0440 %        str2double(get(hObject,'String')) returns contents of Frequency as a double
0441 
0442 
0443 % --- Executes during object creation, after setting all properties.
0444 function Frequency_CreateFcn(hObject, eventdata, handles)
0445 % hObject    handle to Frequency (see GCBO)
0446 % eventdata  reserved - to be defined in a future version of MATLAB
0447 % handles    empty - handles not created until after all CreateFcns called
0448 
0449 % Hint: edit controls usually have a white background on Windows.
0450 %       See ISPC and COMPUTER.
0451 if ispc
0452     set(hObject,'BackgroundColor','white');
0453 else
0454     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
0455 end
0456 
0457 
0458 
0459 
0460 % --- Executes on button press in FixedCheckbox.
0461 function FixedCheckbox_Callback(hObject, eventdata, handles)
0462 % hObject    handle to FixedCheckbox (see GCBO)
0463 % eventdata  reserved - to be defined in a future version of MATLAB
0464 % handles    structure with handles and user data (see GUIDATA)
0465 
0466 % Hint: get(hObject,'Value') returns toggle state of FixedCheckbox
0467 
0468 handles.fixed = get(hObject,'Value');
0469 guidata(gcbo,handles);

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005