Dawn@4: function varargout = vs_SelectParameters(varargin) Dawn@4: % VS_SELECTPARAMETERS M-file for vs_SelectParameters.fig Dawn@4: % VS_SELECTPARAMETERS, by itself, creates a new VS_SELECTPARAMETERS or raises the existing Dawn@4: % singleton*. Dawn@4: % Dawn@4: % H = VS_SELECTPARAMETERS returns the handle to a new VS_SELECTPARAMETERS or the handle to Dawn@4: % the existing singleton*. Dawn@4: % Dawn@4: % VS_SELECTPARAMETERS('CALLBACK',hObject,eventData,handles,...) calls the local Dawn@4: % function named CALLBACK in VS_SELECTPARAMETERS.M with the given input arguments. Dawn@4: % Dawn@4: % VS_SELECTPARAMETERS('Property','Value',...) creates a new VS_SELECTPARAMETERS or raises the Dawn@4: % existing singleton*. Starting from the left, property value pairs are Dawn@4: % applied to the GUI before vs_SelectParameters_OpeningFcn gets called. An Dawn@4: % unrecognized property name or invalid value makes property application Dawn@4: % stop. All inputs are passed to vs_SelectParameters_OpeningFcn via varargin. Dawn@4: % Dawn@4: % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one Dawn@4: % instance to run (singleton)". Dawn@4: % Dawn@4: % See also: GUIDE, GUIDATA, GUIHANDLES Dawn@4: Dawn@4: % Edit the above text to modify the response to help vs_SelectParameters Dawn@4: Dawn@4: % Last Modified by GUIDE v2.5 16-Oct-2009 14:30:10 Dawn@4: Dawn@4: % Begin initialization code - DO NOT EDIT Dawn@4: gui_Singleton = 1; Dawn@4: gui_State = struct('gui_Name', mfilename, ... Dawn@4: 'gui_Singleton', gui_Singleton, ... Dawn@4: 'gui_OpeningFcn', @vs_SelectParameters_OpeningFcn, ... Dawn@4: 'gui_OutputFcn', @vs_SelectParameters_OutputFcn, ... Dawn@4: 'gui_LayoutFcn', [] , ... Dawn@4: 'gui_Callback', []); Dawn@4: if nargin && ischar(varargin{1}) Dawn@4: gui_State.gui_Callback = str2func(varargin{1}); Dawn@4: end Dawn@4: Dawn@4: if nargout Dawn@4: [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); Dawn@4: else Dawn@4: gui_mainfcn(gui_State, varargin{:}); Dawn@4: end Dawn@4: % End initialization code - DO NOT EDIT Dawn@4: Dawn@4: Dawn@4: % --- Executes just before vs_SelectParameters is made visible. Dawn@4: function vs_SelectParameters_OpeningFcn(hObject, eventdata, handles, varargin) Dawn@4: % This function has no output args, see OutputFcn. Dawn@4: % hObject handle to figure Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: % varargin command line arguments to vs_SelectParameters (see VARARGIN) Dawn@4: Dawn@4: % Choose default command line output for vs_SelectParameters Dawn@4: handles.output = hObject; Dawn@4: Dawn@4: PEfig = vs_ParameterEstimation; Dawn@4: PEhandle = guidata(PEfig); Dawn@4: handles.PEfig = PEfig; Dawn@4: handles.PEhandle = PEhandle; Dawn@4: handles.VSHandle = PEhandle.VSHandle; Dawn@4: Dawn@4: % get the list of parameters: Dawn@4: paramlist = func_getparameterlist(); Dawn@4: paraminx = 1:length(paramlist); Dawn@4: Dawn@4: % check to see if "Other" F0/FMT have been enabled Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: if (VSData.vars.F0OtherEnable == 0) Dawn@4: paraminx(func_getparameterlist('F0 (Other)')) = 0; Dawn@4: end Dawn@4: Dawn@4: % check to see which formant algorithm to use Dawn@4: if (VSData.vars.FormantsOtherEnable == 0) Dawn@4: paraminx(func_getparameterlist('F1, F2, F3, F4 (Other)')) = 0; Dawn@4: end Dawn@4: Dawn@4: paraminx(paraminx == 0) = []; Dawn@4: paramlist = paramlist(paraminx); Dawn@4: Dawn@4: set(handles.listbox_paramlist, 'String', paramlist); Dawn@4: Dawn@4: selectedparamlist = VSData.vars.PE_params; Dawn@4: Dawn@4: % work out which ones to select Dawn@4: paraminx = zeros(length(paramlist), 1); Dawn@4: cnt = 1; Dawn@4: for k=1:length(paramlist) Dawn@4: for n=1:length(selectedparamlist) Dawn@4: if (strcmp(paramlist(k), selectedparamlist(n))) Dawn@4: paraminx(cnt) = k; Dawn@4: cnt = cnt + 1; Dawn@4: break; Dawn@4: end Dawn@4: end Dawn@4: end Dawn@4: paraminx(paraminx==0) = []; Dawn@4: handles.paraminx = paraminx; Dawn@4: Dawn@4: set(handles.listbox_paramlist, 'Value', handles.paraminx); Dawn@4: Dawn@4: if (isempty(handles.paraminx)) Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'None'); Dawn@4: elseif (length(handles.paraminx) == length(paramlist)) Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'All'); Dawn@4: else Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'Custom'); Dawn@4: end Dawn@4: Dawn@4: % Update handles structure Dawn@4: guidata(hObject, handles); Dawn@4: Dawn@4: % UIWAIT makes vs_SelectParameters wait for user response (see UIRESUME) Dawn@4: % uiwait(handles.figure_SelectParameters); Dawn@4: Dawn@4: Dawn@4: % --- Outputs from this function are returned to the command line. Dawn@4: function varargout = vs_SelectParameters_OutputFcn(hObject, eventdata, handles) Dawn@4: % varargout cell array for returning output args (see VARARGOUT); Dawn@4: % hObject handle to figure Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Get default command line output from handles structure Dawn@4: varargout{1} = handles.output; Dawn@4: Dawn@4: Dawn@4: % --- Executes on selection change in listbox_paramlist. Dawn@4: function listbox_paramlist_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to listbox_paramlist (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: newinx = get(hObject, 'Value'); Dawn@4: handles.paraminx = setxor(handles.paraminx, newinx); Dawn@4: Dawn@4: paramlist = get(hObject, 'String'); Dawn@4: VSData.vars.PE_params = paramlist(handles.paraminx); Dawn@4: Dawn@4: set(handles.listbox_paramlist, 'Value', handles.paraminx); Dawn@4: Dawn@4: guidata(hObject, handles); Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: Dawn@4: if (isempty(handles.paraminx)) Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'None'); Dawn@4: elseif (length(handles.paraminx) == length(paramlist)) Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'All'); Dawn@4: else Dawn@4: set(handles.PEhandle.edit_parameterselection, 'String', 'Custom'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function listbox_paramlist_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to listbox_paramlist (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: listbox controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes on button press in pushbutton_OK. Dawn@4: function pushbutton_OK_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to pushbutton_OK (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: delete(gcf);