Dawn@4
|
1 function varargout = vs_SelectParameters(varargin)
|
Dawn@4
|
2 % VS_SELECTPARAMETERS M-file for vs_SelectParameters.fig
|
Dawn@4
|
3 % VS_SELECTPARAMETERS, by itself, creates a new VS_SELECTPARAMETERS or raises the existing
|
Dawn@4
|
4 % singleton*.
|
Dawn@4
|
5 %
|
Dawn@4
|
6 % H = VS_SELECTPARAMETERS returns the handle to a new VS_SELECTPARAMETERS or the handle to
|
Dawn@4
|
7 % the existing singleton*.
|
Dawn@4
|
8 %
|
Dawn@4
|
9 % VS_SELECTPARAMETERS('CALLBACK',hObject,eventData,handles,...) calls the local
|
Dawn@4
|
10 % function named CALLBACK in VS_SELECTPARAMETERS.M with the given input arguments.
|
Dawn@4
|
11 %
|
Dawn@4
|
12 % VS_SELECTPARAMETERS('Property','Value',...) creates a new VS_SELECTPARAMETERS or raises the
|
Dawn@4
|
13 % existing singleton*. Starting from the left, property value pairs are
|
Dawn@4
|
14 % applied to the GUI before vs_SelectParameters_OpeningFcn gets called. An
|
Dawn@4
|
15 % unrecognized property name or invalid value makes property application
|
Dawn@4
|
16 % stop. All inputs are passed to vs_SelectParameters_OpeningFcn via varargin.
|
Dawn@4
|
17 %
|
Dawn@4
|
18 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
|
Dawn@4
|
19 % instance to run (singleton)".
|
Dawn@4
|
20 %
|
Dawn@4
|
21 % See also: GUIDE, GUIDATA, GUIHANDLES
|
Dawn@4
|
22
|
Dawn@4
|
23 % Edit the above text to modify the response to help vs_SelectParameters
|
Dawn@4
|
24
|
Dawn@4
|
25 % Last Modified by GUIDE v2.5 16-Oct-2009 14:30:10
|
Dawn@4
|
26
|
Dawn@4
|
27 % Begin initialization code - DO NOT EDIT
|
Dawn@4
|
28 gui_Singleton = 1;
|
Dawn@4
|
29 gui_State = struct('gui_Name', mfilename, ...
|
Dawn@4
|
30 'gui_Singleton', gui_Singleton, ...
|
Dawn@4
|
31 'gui_OpeningFcn', @vs_SelectParameters_OpeningFcn, ...
|
Dawn@4
|
32 'gui_OutputFcn', @vs_SelectParameters_OutputFcn, ...
|
Dawn@4
|
33 'gui_LayoutFcn', [] , ...
|
Dawn@4
|
34 'gui_Callback', []);
|
Dawn@4
|
35 if nargin && ischar(varargin{1})
|
Dawn@4
|
36 gui_State.gui_Callback = str2func(varargin{1});
|
Dawn@4
|
37 end
|
Dawn@4
|
38
|
Dawn@4
|
39 if nargout
|
Dawn@4
|
40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
Dawn@4
|
41 else
|
Dawn@4
|
42 gui_mainfcn(gui_State, varargin{:});
|
Dawn@4
|
43 end
|
Dawn@4
|
44 % End initialization code - DO NOT EDIT
|
Dawn@4
|
45
|
Dawn@4
|
46
|
Dawn@4
|
47 % --- Executes just before vs_SelectParameters is made visible.
|
Dawn@4
|
48 function vs_SelectParameters_OpeningFcn(hObject, eventdata, handles, varargin)
|
Dawn@4
|
49 % This function has no output args, see OutputFcn.
|
Dawn@4
|
50 % hObject handle to figure
|
Dawn@4
|
51 % eventdata reserved - to be defined in a future version of MATLAB
|
Dawn@4
|
52 % handles structure with handles and user data (see GUIDATA)
|
Dawn@4
|
53 % varargin command line arguments to vs_SelectParameters (see VARARGIN)
|
Dawn@4
|
54
|
Dawn@4
|
55 % Choose default command line output for vs_SelectParameters
|
Dawn@4
|
56 handles.output = hObject;
|
Dawn@4
|
57
|
Dawn@4
|
58 PEfig = vs_ParameterEstimation;
|
Dawn@4
|
59 PEhandle = guidata(PEfig);
|
Dawn@4
|
60 handles.PEfig = PEfig;
|
Dawn@4
|
61 handles.PEhandle = PEhandle;
|
Dawn@4
|
62 handles.VSHandle = PEhandle.VSHandle;
|
Dawn@4
|
63
|
Dawn@4
|
64 % get the list of parameters:
|
Dawn@4
|
65 paramlist = func_getparameterlist();
|
Dawn@4
|
66 paraminx = 1:length(paramlist);
|
Dawn@4
|
67
|
Dawn@4
|
68 % check to see if "Other" F0/FMT have been enabled
|
Dawn@4
|
69 VSData = guidata(handles.VSHandle);
|
Dawn@4
|
70 if (VSData.vars.F0OtherEnable == 0)
|
Dawn@4
|
71 paraminx(func_getparameterlist('F0 (Other)')) = 0;
|
Dawn@4
|
72 end
|
Dawn@4
|
73
|
Dawn@4
|
74 % check to see which formant algorithm to use
|
Dawn@4
|
75 if (VSData.vars.FormantsOtherEnable == 0)
|
Dawn@4
|
76 paraminx(func_getparameterlist('F1, F2, F3, F4 (Other)')) = 0;
|
Dawn@4
|
77 end
|
Dawn@4
|
78
|
Dawn@4
|
79 paraminx(paraminx == 0) = [];
|
Dawn@4
|
80 paramlist = paramlist(paraminx);
|
Dawn@4
|
81
|
Dawn@4
|
82 set(handles.listbox_paramlist, 'String', paramlist);
|
Dawn@4
|
83
|
Dawn@4
|
84 selectedparamlist = VSData.vars.PE_params;
|
Dawn@4
|
85
|
Dawn@4
|
86 % work out which ones to select
|
Dawn@4
|
87 paraminx = zeros(length(paramlist), 1);
|
Dawn@4
|
88 cnt = 1;
|
Dawn@4
|
89 for k=1:length(paramlist)
|
Dawn@4
|
90 for n=1:length(selectedparamlist)
|
Dawn@4
|
91 if (strcmp(paramlist(k), selectedparamlist(n)))
|
Dawn@4
|
92 paraminx(cnt) = k;
|
Dawn@4
|
93 cnt = cnt + 1;
|
Dawn@4
|
94 break;
|
Dawn@4
|
95 end
|
Dawn@4
|
96 end
|
Dawn@4
|
97 end
|
Dawn@4
|
98 paraminx(paraminx==0) = [];
|
Dawn@4
|
99 handles.paraminx = paraminx;
|
Dawn@4
|
100
|
Dawn@4
|
101 set(handles.listbox_paramlist, 'Value', handles.paraminx);
|
Dawn@4
|
102
|
Dawn@4
|
103 if (isempty(handles.paraminx))
|
Dawn@4
|
104 set(handles.PEhandle.edit_parameterselection, 'String', 'None');
|
Dawn@4
|
105 elseif (length(handles.paraminx) == length(paramlist))
|
Dawn@4
|
106 set(handles.PEhandle.edit_parameterselection, 'String', 'All');
|
Dawn@4
|
107 else
|
Dawn@4
|
108 set(handles.PEhandle.edit_parameterselection, 'String', 'Custom');
|
Dawn@4
|
109 end
|
Dawn@4
|
110
|
Dawn@4
|
111 % Update handles structure
|
Dawn@4
|
112 guidata(hObject, handles);
|
Dawn@4
|
113
|
Dawn@4
|
114 % UIWAIT makes vs_SelectParameters wait for user response (see UIRESUME)
|
Dawn@4
|
115 % uiwait(handles.figure_SelectParameters);
|
Dawn@4
|
116
|
Dawn@4
|
117
|
Dawn@4
|
118 % --- Outputs from this function are returned to the command line.
|
Dawn@4
|
119 function varargout = vs_SelectParameters_OutputFcn(hObject, eventdata, handles)
|
Dawn@4
|
120 % varargout cell array for returning output args (see VARARGOUT);
|
Dawn@4
|
121 % hObject handle to figure
|
Dawn@4
|
122 % eventdata reserved - to be defined in a future version of MATLAB
|
Dawn@4
|
123 % handles structure with handles and user data (see GUIDATA)
|
Dawn@4
|
124
|
Dawn@4
|
125 % Get default command line output from handles structure
|
Dawn@4
|
126 varargout{1} = handles.output;
|
Dawn@4
|
127
|
Dawn@4
|
128
|
Dawn@4
|
129 % --- Executes on selection change in listbox_paramlist.
|
Dawn@4
|
130 function listbox_paramlist_Callback(hObject, eventdata, handles)
|
Dawn@4
|
131 % hObject handle to listbox_paramlist (see GCBO)
|
Dawn@4
|
132 % eventdata reserved - to be defined in a future version of MATLAB
|
Dawn@4
|
133 % handles structure with handles and user data (see GUIDATA)
|
Dawn@4
|
134
|
Dawn@4
|
135 VSData = guidata(handles.VSHandle);
|
Dawn@4
|
136 newinx = get(hObject, 'Value');
|
Dawn@4
|
137 handles.paraminx = setxor(handles.paraminx, newinx);
|
Dawn@4
|
138
|
Dawn@4
|
139 paramlist = get(hObject, 'String');
|
Dawn@4
|
140 VSData.vars.PE_params = paramlist(handles.paraminx);
|
Dawn@4
|
141
|
Dawn@4
|
142 set(handles.listbox_paramlist, 'Value', handles.paraminx);
|
Dawn@4
|
143
|
Dawn@4
|
144 guidata(hObject, handles);
|
Dawn@4
|
145 guidata(handles.VSHandle, VSData);
|
Dawn@4
|
146
|
Dawn@4
|
147 if (isempty(handles.paraminx))
|
Dawn@4
|
148 set(handles.PEhandle.edit_parameterselection, 'String', 'None');
|
Dawn@4
|
149 elseif (length(handles.paraminx) == length(paramlist))
|
Dawn@4
|
150 set(handles.PEhandle.edit_parameterselection, 'String', 'All');
|
Dawn@4
|
151 else
|
Dawn@4
|
152 set(handles.PEhandle.edit_parameterselection, 'String', 'Custom');
|
Dawn@4
|
153 end
|
Dawn@4
|
154
|
Dawn@4
|
155
|
Dawn@4
|
156
|
Dawn@4
|
157 % --- Executes during object creation, after setting all properties.
|
Dawn@4
|
158 function listbox_paramlist_CreateFcn(hObject, eventdata, handles)
|
Dawn@4
|
159 % hObject handle to listbox_paramlist (see GCBO)
|
Dawn@4
|
160 % eventdata reserved - to be defined in a future version of MATLAB
|
Dawn@4
|
161 % handles empty - handles not created until after all CreateFcns called
|
Dawn@4
|
162
|
Dawn@4
|
163 % Hint: listbox controls usually have a white background on Windows.
|
Dawn@4
|
164 % See ISPC and COMPUTER.
|
Dawn@4
|
165 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Dawn@4
|
166 set(hObject,'BackgroundColor','white');
|
Dawn@4
|
167 end
|
Dawn@4
|
168
|
Dawn@4
|
169
|
Dawn@4
|
170 % --- Executes on button press in pushbutton_OK.
|
Dawn@4
|
171 function pushbutton_OK_Callback(hObject, eventdata, handles)
|
Dawn@4
|
172 % hObject handle to pushbutton_OK (see GCBO)
|
Dawn@4
|
173 % eventdata reserved - to be defined in a future version of MATLAB
|
Dawn@4
|
174 % handles structure with handles and user data (see GUIDATA)
|
Dawn@4
|
175
|
Dawn@4
|
176 delete(gcf);
|