comparison Code/Descriptors/Matlab/MPEG7/FromWeb/VoiceSauce/vs_OutputToText.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents
children
comparison
equal deleted inserted replaced
3:e1cfa7765647 4:92ca03a8fa99
1 function varargout = vs_OutputToText(varargin)
2 % VS_OUTPUTTOTEXT M-file for vs_OutputToText.fig
3 % VS_OUTPUTTOTEXT, by itself, creates a new VS_OUTPUTTOTEXT or raises
4 % the existing
5 % singleton*.
6 %
7 % H = VS_OUTPUTTOTEXT returns the handle to a new VS_OUTPUTTOTEXT or the handle to
8 % the existing singleton*.
9 %
10 % VS_OUTPUTTOTEXT('CALLBACK',hObject,eventData,handles,...) calls the local
11 % function named CALLBACK in VS_OUTPUTTOTEXT.M with the given input arguments.
12 %
13 % VS_OUTPUTTOTEXT('Property','Value',...) creates a new VS_OUTPUTTOTEXT or raises the
14 % existing singleton*. Starting from the left, property value pairs are
15 % applied to the GUI before vs_OutputToText_OpeningFcn gets called. An
16 % unrecognized property name or invalid value makes property application
17 % stop. All inputs are passed to vs_OutputToText_OpeningFcn via varargin.
18 %
19 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
20 % instance to run (singleton)".
21 %
22 % See also: GUIDE, GUIDATA, GUIHANDLES
23
24 % Edit the above text to modify the response to help vs_OutputToText
25
26 % Last Modified by GUIDE v2.5 08-Oct-2009 00:50:59
27
28 % Begin initialization code - DO NOT EDIT
29 gui_Singleton = 1;
30 gui_State = struct('gui_Name', mfilename, ...
31 'gui_Singleton', gui_Singleton, ...
32 'gui_OpeningFcn', @vs_OutputToText_OpeningFcn, ...
33 'gui_OutputFcn', @vs_OutputToText_OutputFcn, ...
34 'gui_LayoutFcn', [] , ...
35 'gui_Callback', []);
36 if nargin && ischar(varargin{1})
37 gui_State.gui_Callback = str2func(varargin{1});
38 end
39
40 if nargout
41 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
42 else
43 gui_mainfcn(gui_State, varargin{:});
44 end
45 % End initialization code - DO NOT EDIT
46
47
48 % --- Executes just before vs_OutputToText is made visible.
49 function vs_OutputToText_OpeningFcn(hObject, eventdata, handles, varargin)
50 % This function has no output args, see OutputFcn.
51 % hObject handle to figure
52 % eventdata reserved - to be defined in a future version of MATLAB
53 % handles structure with handles and user data (see GUIDATA)
54 % varargin command line arguments to vs_OutputToText (see VARARGIN)
55
56 % Choose default command line output for vs_OutputToText
57 handles.output = hObject;
58
59 if (~isfield(handles, 'VSHandle'))
60 VSHandle = VoiceSauce;
61 handles.VSHandle = VSHandle;
62 end
63
64 % restore the variables from initialization
65 setGUIVariables(handles);
66
67 set(handles.uipanel_Segments,'SelectionChangeFcn',@segments_buttongroup_SelectionChangeFcn);
68 set(handles.uipanel_OutputOptions,'SelectionChangeFcn',@outputoptions_buttongroup_SelectionChangeFcn);
69 set(handles.listbox_Parameters_matfilelist, 'KeyPressFcn', @matfiles_listbox_KeyPressFcn);
70
71 % Update handles structure
72 guidata(hObject, handles);
73
74 % UIWAIT makes vs_OutputToText wait for user response (see UIRESUME)
75 % uiwait(handles.figure_OutputToText);
76
77
78 % --- Outputs from this function are returned to the command line.
79 function varargout = vs_OutputToText_OutputFcn(hObject, eventdata, handles)
80 % varargout cell array for returning output args (see VARARGOUT);
81 % hObject handle to figure
82 % eventdata reserved - to be defined in a future version of MATLAB
83 % handles structure with handles and user data (see GUIDATA)
84
85 % Get default command line output from handles structure
86 varargout{1} = handles.output;
87
88
89 function setGUIVariables(handles)
90 VSData = guidata(handles.VSHandle);
91 vars = VSData.vars;
92
93 paramlist = func_getoutputparameterlist();
94 set(handles.listbox_Parameters_paramlist, 'String', paramlist);
95
96 % update output file names
97 VSData.vars.OT_Single = [vars.OT_outputdir vars.dirdelimiter vars.OT_singleFilename];
98 VSData.vars.OT_F0CPPE = [vars.OT_outputdir vars.dirdelimiter vars.OT_F0CPPEfilename];
99 VSData.vars.OT_Formants = [vars.OT_outputdir vars.dirdelimiter vars.OT_Formantsfilename];
100 VSData.vars.OT_HA = [vars.OT_outputdir vars.dirdelimiter vars.OT_Hx_Axfilename];
101 VSData.vars.OT_HxHx = [vars.OT_outputdir vars.dirdelimiter vars.OT_HxHxfilename];
102 VSData.vars.OT_HxAx = [vars.OT_outputdir vars.dirdelimiter vars.OT_HxAxfilename];
103 VSData.vars.OT_EGG = [vars.OT_outputdir vars.dirdelimiter vars.OT_EGGfilename];
104 guidata(handles.VSHandle, VSData);
105 VSData = guidata(handles.VSHandle);
106 vars = VSData.vars;
107
108 % default is everything selected
109 if (isempty(vars.OT_selectedParams))
110 vars.OT_selectedParams = 1:length(paramlist);
111 VSData.vars = vars;
112 guidata(handles.VSHandle, VSData);
113 end
114
115 set(handles.listbox_Parameters_paramlist, 'Value', vars.OT_selectedParams);
116 set(handles.edit_Parameters_num, 'String', num2str(sum(vars.OT_selectedParams > 0)));
117
118 set(handles.edit_Parameters_matdir, 'String', vars.OT_matdir);
119 set(handles.checkbox_Parameters_includesubdir, 'Value', vars.OT_includesubdir);
120
121 if (vars.OT_includesubdir == 1)
122 func_setlistbox(handles.listbox_Parameters_matfilelist, vars.OT_matdir, 'recurse', vars, '*.mat');
123 else
124 func_setlistbox(handles.listbox_Parameters_matfilelist, vars.OT_matdir, 'none', vars, '*.mat');
125 end
126
127 set(handles.edit_Parameters_Textgriddir, 'String', vars.OT_Textgriddir);
128 set(handles.checkbox_Parameters_includeEGG, 'Value', vars.OT_includeEGG);
129
130 if (vars.OT_includeEGG == 1)
131 set(handles.edit_Parameters_EGGdir, 'Enable', 'On');
132 set(handles.pushbutton_Parameters_outBrowse, 'Enable', 'On');
133 end
134
135 set(handles.edit_Parameters_EGGdir, 'String', vars.OT_EGGdir);
136 set(handles.edit_Parameters_outdir, 'String', vars.OT_outputdir);
137
138 set(handles.checkbox_Parameters_includeTextgrids, 'Value', vars.OT_includeTextgridLabels);
139 set(handles.popupmenu_Parameters_delimiter, 'Value', vars.OT_columndelimiter);
140
141 set(handles.radiobutton_noSegments, 'Value', vars.OT_noSegments);
142 set(handles.radiobutton_useSegments, 'Value', vars.OT_useSegments);
143
144 if (vars.OT_useSegments == 1)
145 set(handles.edit_numSegments, 'String', num2str(vars.OT_numSegments));
146 set(handles.edit_numSegments, 'Enable', 'On');
147 end
148
149 set(handles.radiobutton_Singlefile, 'Value', vars.OT_singleFile);
150 set(handles.radiobutton_Multiplefiles, 'value', vars.OT_multipleFiles);
151
152 set(handles.edit_OutputOptions_SingleFile, 'String', vars.OT_Single);
153 set(handles.edit_OutputOptions_F0CPPE, 'String', vars.OT_F0CPPE);
154 set(handles.edit_OutputOptions_Formants, 'String', vars.OT_Formants);
155 set(handles.edit_OutputOptions_Hx_Ax, 'String', vars.OT_HA);
156 set(handles.edit_OutputOptions_HxHx, 'String', vars.OT_HxHx);
157 set(handles.edit_OutputOptions_HxAx, 'String', vars.OT_HxAx);
158 set(handles.edit_OutputOptions_EGG, 'String', vars.OT_EGG);
159
160 if (vars.OT_multipleFiles == 1)
161 set(handles.edit_OutputOptions_SingleFile, 'Enable', 'Off');
162 set(handles.pushbutton_OutputOptions_SingleBrowse, 'Enable', 'Off');
163
164 set(handles.edit_OutputOptions_F0CPPE, 'Enable', 'On');
165 set(handles.edit_OutputOptions_Formants, 'Enable', 'On');
166 set(handles.edit_OutputOptions_Hx_Ax, 'Enable', 'On');
167 set(handles.edit_OutputOptions_HxHx, 'Enable', 'On');
168 set(handles.edit_OutputOptions_HxAx, 'Enable', 'On');
169 set(handles.edit_OutputOptions_EGG, 'Enable', 'On');
170
171 set(handles.pushbutton_OO_F0CPPEBrowse, 'Enable', 'On');
172 set(handles.pushbutton_OO_FormantsBrowse, 'Enable', 'On');
173 set(handles.pushbutton_OO_Hx_AxBrowse, 'Enable', 'On');
174 set(handles.pushbutton_OO_HxHxBrowse, 'Enable', 'On');
175 set(handles.pushbutton_OO_HxAxBrowse', 'Enable', 'On');
176 set(handles.pushbutton_OO_EGGBrowse', 'Enable', 'On');
177 end
178
179
180 % --- Executes on selection change in listbox_Parameters_paramlist.
181 function listbox_Parameters_paramlist_Callback(hObject, eventdata, handles)
182 % hObject handle to listbox_Parameters_paramlist (see GCBO)
183 % eventdata reserved - to be defined in a future version of MATLAB
184 % handles structure with handles and user data (see GUIDATA)
185
186 VSData = guidata(handles.VSHandle);
187 inx = get(hObject, 'Value');
188
189 % now add the new entries and remove the old ones which are already
190 % selected
191 VSData.vars.OT_selectedParams = setxor(VSData.vars.OT_selectedParams, inx);
192 set(hObject, 'Value', VSData.vars.OT_selectedParams);
193 guidata(handles.VSHandle, VSData);
194 set(handles.edit_Parameters_num, 'String', num2str(sum(VSData.vars.OT_selectedParams > 0)));
195
196
197 % Hints: contents = get(hObject,'String') returns listbox_Parameters_paramlist contents as cell array
198 % contents{get(hObject,'Value')} returns selected item from listbox_Parameters_paramlist
199
200
201 % --- Executes during object creation, after setting all properties.
202 function listbox_Parameters_paramlist_CreateFcn(hObject, eventdata, handles)
203 % hObject handle to listbox_Parameters_paramlist (see GCBO)
204 % eventdata reserved - to be defined in a future version of MATLAB
205 % handles empty - handles not created until after all CreateFcns called
206
207 % Hint: listbox controls usually have a white background on Windows.
208 % See ISPC and COMPUTER.
209 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
210 set(hObject,'BackgroundColor','white');
211 end
212
213
214
215 function edit_Parameters_num_Callback(hObject, eventdata, handles)
216 % hObject handle to edit_Parameters_num (see GCBO)
217 % eventdata reserved - to be defined in a future version of MATLAB
218 % handles structure with handles and user data (see GUIDATA)
219
220 % Hints: get(hObject,'String') returns contents of edit_Parameters_num as text
221 % str2double(get(hObject,'String')) returns contents of edit_Parameters_num as a double
222
223
224 % --- Executes during object creation, after setting all properties.
225 function edit_Parameters_num_CreateFcn(hObject, eventdata, handles)
226 % hObject handle to edit_Parameters_num (see GCBO)
227 % eventdata reserved - to be defined in a future version of MATLAB
228 % handles empty - handles not created until after all CreateFcns called
229
230 % Hint: edit controls usually have a white background on Windows.
231 % See ISPC and COMPUTER.
232 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
233 set(hObject,'BackgroundColor','white');
234 end
235
236
237
238 function edit_Parameters_outdir_Callback(hObject, eventdata, handles)
239 % hObject handle to edit_Parameters_outdir (see GCBO)
240 % eventdata reserved - to be defined in a future version of MATLAB
241 % handles structure with handles and user data (see GUIDATA)
242
243 % Hints: get(hObject,'String') returns contents of edit_Parameters_outdir as text
244 % str2double(get(hObject,'String')) returns contents of edit_Parameters_outdir as a double
245 VSData = guidata(handles.VSHandle);
246 newdir = get(hObject, 'String');
247 if (exist(newdir, 'dir') == 7) % new dir exists
248 if (newdir(end) ~= VSData.vars.dirdelimiter)
249 newdir(end + 1) = VSData.vars.dirdelimiter;
250 end
251 VSData.vars.OT_outputdir = newdir;
252 updateOutputFiles(handles);
253 else
254 msgbox('Error: directory not found.', 'Error', 'error', 'modal');
255 set(hObject, 'String', VSData.vars.OT_outputdir);
256 end
257 guidata(handles.VSHandle, VSData);
258
259
260 % update the filenames in Output Options
261 function updateOutputFiles(handles)
262 VSData = guidata(handles.VSHandle);
263
264 VSData.vars.OT_Single = [VSData.vars.OT_outputdir VSData.vars.OT_singleFilename];
265 VSData.vars.OT_F0CPPE = [VSData.vars.OT_outputdir VSData.vars.OT_F0CPPEfilename];
266 VSData.vars.OT_Formants = [VSData.vars.OT_outputdir VSData.vars.OT_Formantsfilename];
267 VSData.vars.OT_HA = [VSData.vars.OT_outputdir VSData.vars.OT_Hx_Axfilename];
268 VSData.vars.OT_HxHx = [VSData.vars.OT_outputdir VSData.vars.OT_HxHxfilename];
269 VSData.vars.OT_HxAx = [VSData.vars.OT_outputdir VSData.vars.OT_HxAxfilename];
270 VSData.vars.OT_EGG = [VSData.vars.OT_outputdir VSData.vars.OT_EGGfilename];
271
272 set(handles.edit_OutputOptions_SingleFile, 'String', VSData.vars.OT_Single);
273 set(handles.edit_OutputOptions_F0CPPE, 'String', VSData.vars.OT_F0CPPE);
274 set(handles.edit_OutputOptions_Formants, 'String', VSData.vars.OT_Formants);
275 set(handles.edit_OutputOptions_Hx_Ax, 'String', VSData.vars.OT_HA);
276 set(handles.edit_OutputOptions_HxHx, 'String', VSData.vars.OT_HxHx);
277 set(handles.edit_OutputOptions_HxAx, 'String', VSData.vars.OT_HxAx);
278 set(handles.edit_OutputOptions_EGG, 'String', VSData.vars.OT_EGG);
279 set(handles.edit_Parameters_outdir, 'String', VSData.vars.OT_outputdir);
280 set(handles.edit_Parameters_EGGdir, 'String', VSData.vars.OT_EGGdir);
281 guidata(handles.VSHandle, VSData);
282
283
284 % --- Executes during object creation, after setting all properties.
285 function edit_Parameters_outdir_CreateFcn(hObject, eventdata, handles)
286 % hObject handle to edit_Parameters_outdir (see GCBO)
287 % eventdata reserved - to be defined in a future version of MATLAB
288 % handles empty - handles not created until after all CreateFcns called
289
290 % Hint: edit controls usually have a white background on Windows.
291 % See ISPC and COMPUTER.
292 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
293 set(hObject,'BackgroundColor','white');
294 end
295
296
297 % --- Executes on button press in pushbutton_Parameters_outBrowse.
298 function pushbutton_Parameters_outBrowse_Callback(hObject, eventdata, handles)
299 % hObject handle to pushbutton_Parameters_outBrowse (see GCBO)
300 % eventdata reserved - to be defined in a future version of MATLAB
301 % handles structure with handles and user data (see GUIDATA)
302 VSData = guidata(handles.VSHandle);
303 newdir = uigetdir(VSData.vars.OT_outputdir);
304 if (ischar(newdir) == 1)
305 VSData.vars.OT_outputdir = [newdir VSData.vars.dirdelimiter];
306 set(handles.edit_Parameters_outdir, 'String', VSData.vars.OT_outputdir);
307 guidata(handles.VSHandle, VSData);
308 updateOutputFiles(handles);
309 end
310
311
312 % --- Executes on selection change in popupmenu_Parameters_delimiter.
313 function popupmenu_Parameters_delimiter_Callback(hObject, eventdata, handles)
314 % hObject handle to popupmenu_Parameters_delimiter (see GCBO)
315 % eventdata reserved - to be defined in a future version of MATLAB
316 % handles structure with handles and user data (see GUIDATA)
317
318 % Hints: contents = get(hObject,'String') returns popupmenu_Parameters_delimiter contents as cell array
319 % contents{get(hObject,'Value')} returns selected item from popupmenu_Parameters_delimiter
320 VSData = guidata(handles.VSHandle);
321 VSData.vars.OT_columndelimiter = get(hObject, 'Value');
322 guidata(handles.VSHandle, VSData);
323
324
325 % --- Executes during object creation, after setting all properties.
326 function popupmenu_Parameters_delimiter_CreateFcn(hObject, eventdata, handles)
327 % hObject handle to popupmenu_Parameters_delimiter (see GCBO)
328 % eventdata reserved - to be defined in a future version of MATLAB
329 % handles empty - handles not created until after all CreateFcns called
330
331 % Hint: popupmenu controls usually have a white background on Windows.
332 % See ISPC and COMPUTER.
333 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
334 set(hObject,'BackgroundColor','white');
335 end
336
337
338 % --- Executes on button press in checkbox_Parameters_includeEGG.
339 function checkbox_Parameters_includeEGG_Callback(hObject, eventdata, handles)
340 % hObject handle to checkbox_Parameters_includeEGG (see GCBO)
341 % eventdata reserved - to be defined in a future version of MATLAB
342 % handles structure with handles and user data (see GUIDATA)
343
344 VSData = guidata(handles.VSHandle);
345
346 if (get(hObject, 'Value') == 1)
347 set(handles.edit_Parameters_EGGdir, 'Enable', 'On');
348 set(handles.pushbutton_Parameters_EGGBrowse, 'Enable', 'On');
349 VSData.vars.OT_includeEGG = 1;
350 else
351 set(handles.edit_Parameters_EGGdir, 'Enable', 'Off');
352 set(handles.pushbutton_Parameters_EGGBrowse, 'Enable', 'Off');
353 VSData.vars.OT_includeEGG = 0;
354 end
355 guidata(handles.VSHandle, VSData);
356
357
358 function edit_Parameters_matdir_Callback(hObject, eventdata, handles)
359 % hObject handle to edit_Parameters_matdir (see GCBO)
360 % eventdata reserved - to be defined in a future version of MATLAB
361 % handles structure with handles and user data (see GUIDATA)
362
363 % Hints: get(hObject,'String') returns contents of edit_Parameters_matdir as text
364 % str2double(get(hObject,'String')) returns contents of edit_Parameters_matdir as a double
365 VSData = guidata(handles.VSHandle);
366 newdir = get(hObject, 'String');
367 if (exist(newdir, 'dir') == 7) % new dir exists
368 VSData = func_setmatdir('OT_matdir', newdir, VSData);
369 set(handles.edit_Parameters_Textgriddir, 'String', newdir);
370
371 if (newdir(end) ~= VSData.vars.dirdelimiter)
372 newdir(end + 1) = VSData.vars.dirdelimiter;
373 end
374 VSData.vars.OT_outputdir = newdir;
375 guidata(handles.VSHandle, VSData);
376 updateOutputFiles(handles);
377 else
378 msgbox('Error: directory not found.', 'Error', 'error', 'modal');
379 set(hObject, 'String', VSData.vars.OT_matdir);
380 end
381 guidata(handles.VSHandle, VSData);
382
383
384 % --- Executes during object creation, after setting all properties.
385 function edit_Parameters_matdir_CreateFcn(hObject, eventdata, handles)
386 % hObject handle to edit_Parameters_matdir (see GCBO)
387 % eventdata reserved - to be defined in a future version of MATLAB
388 % handles empty - handles not created until after all CreateFcns called
389
390 % Hint: edit controls usually have a white background on Windows.
391 % See ISPC and COMPUTER.
392 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
393 set(hObject,'BackgroundColor','white');
394 end
395
396
397 % --- Executes on button press in pushbutton_Parameters_matBrowse.
398 function pushbutton_Parameters_matBrowse_Callback(hObject, eventdata, handles)
399 % hObject handle to pushbutton_Parameters_matBrowse (see GCBO)
400 % eventdata reserved - to be defined in a future version of MATLAB
401 % handles structure with handles and user data (see GUIDATA)
402 VSData = guidata(handles.VSHandle);
403 newdir = uigetdir(VSData.vars.OT_matdir);
404 if (ischar(newdir) == 1)
405 VSData = func_setmatdir('OT_matdir', newdir, VSData);
406 set(handles.edit_Parameters_matdir, 'String', newdir);
407 set(handles.edit_Parameters_Textgriddir, 'String', newdir);
408
409 if (newdir(end) ~= VSData.vars.dirdelimiter)
410 newdir(end + 1) = VSData.vars.dirdelimiter;
411 end
412 VSData.vars.OT_outputdir = newdir;
413 guidata(handles.VSHandle, VSData);
414 updateOutputFiles(handles);
415
416 if (get(handles.checkbox_Parameters_includesubdir, 'Value') == 1)
417 func_setlistbox(handles.listbox_Parameters_matfilelist, VSData.vars.OT_matdir, 'recurse', VSData.vars, '*.mat');
418 else
419 func_setlistbox(handles.listbox_Parameters_matfilelist, VSData.vars.OT_matdir, 'none', VSData.vars, '*.mat');
420 end
421 guidata(handles.VSHandle, VSData);
422 end
423
424
425
426 function edit_Parameters_Textgriddir_Callback(hObject, eventdata, handles)
427 % hObject handle to edit_Parameters_Textgriddir (see GCBO)
428 % eventdata reserved - to be defined in a future version of MATLAB
429 % handles structure with handles and user data (see GUIDATA)
430
431 % Hints: get(hObject,'String') returns contents of edit_Parameters_Textgriddir as text
432 % str2double(get(hObject,'String')) returns contents of edit_Parameters_Textgriddir as a double
433 VSData = guidata(handles.VSHandle);
434 newdir = get(hObject, 'String');
435 if (exist(newdir, 'dir') == 7) % new dir exists
436 VSData.vars.OT_Textgriddir = newdir;
437 else
438 msgbox('Error: directory not found.', 'Error', 'error', 'modal');
439 set(hObject, 'String', VSData.vars.OT_Textgriddir);
440 end
441 guidata(handles.VSHandle, VSData);
442
443
444 % --- Executes during object creation, after setting all properties.
445 function edit_Parameters_Textgriddir_CreateFcn(hObject, eventdata, handles)
446 % hObject handle to edit_Parameters_Textgriddir (see GCBO)
447 % eventdata reserved - to be defined in a future version of MATLAB
448 % handles empty - handles not created until after all CreateFcns called
449
450 % Hint: edit controls usually have a white background on Windows.
451 % See ISPC and COMPUTER.
452 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
453 set(hObject,'BackgroundColor','white');
454 end
455
456
457 % --- Executes on button press in pushbutton_Parameters_TextgridBrowse.
458 function pushbutton_Parameters_TextgridBrowse_Callback(hObject, eventdata, handles)
459 % hObject handle to pushbutton_Parameters_TextgridBrowse (see GCBO)
460 % eventdata reserved - to be defined in a future version of MATLAB
461 % handles structure with handles and user data (see GUIDATA)
462 VSData = guidata(handles.VSHandle);
463 newdir = uigetdir(VSData.vars.OT_Textgriddir);
464 if (ischar(newdir) == 1)
465 VSData.vars.OT_Textgriddir = newdir;
466 set(handles.edit_Parameters_Textgriddir, 'String', newdir);
467 guidata(handles.VSHandle, VSData);
468 end
469
470
471 function edit_Parameters_EGGdir_Callback(hObject, eventdata, handles)
472 % hObject handle to edit_Parameters_EGGdir (see GCBO)
473 % eventdata reserved - to be defined in a future version of MATLAB
474 % handles structure with handles and user data (see GUIDATA)
475
476 % Hints: get(hObject,'String') returns contents of edit_Parameters_EGGdir as text
477 % str2double(get(hObject,'String')) returns contents of edit_Parameters_EGGdir as a double
478 VSData = guidata(handles.VSHandle);
479 newdir = get(hObject, 'String');
480 if (exist(newdir, 'dir') == 7) % new dir exists
481 VSData.vars.OT_EGGdir = newdir;
482 else
483 msgbox('Error: directory not found.', 'Error', 'error', 'modal');
484 set(hObject, 'String', VSData.vars.OT_EGGdir);
485 end
486 guidata(handles.VSHandle, VSData);
487
488
489 % --- Executes during object creation, after setting all properties.
490 function edit_Parameters_EGGdir_CreateFcn(hObject, eventdata, handles)
491 % hObject handle to edit_Parameters_EGGdir (see GCBO)
492 % eventdata reserved - to be defined in a future version of MATLAB
493 % handles empty - handles not created until after all CreateFcns called
494
495 % Hint: edit controls usually have a white background on Windows.
496 % See ISPC and COMPUTER.
497 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
498 set(hObject,'BackgroundColor','white');
499 end
500
501
502 % --- Executes on button press in pushbutton_Parameters_EGGBrowse.
503 function pushbutton_Parameters_EGGBrowse_Callback(hObject, eventdata, handles)
504 % hObject handle to pushbutton_Parameters_EGGBrowse (see GCBO)
505 % eventdata reserved - to be defined in a future version of MATLAB
506 % handles structure with handles and user data (see GUIDATA)
507 VSData = guidata(handles.VSHandle);
508 newdir = uigetdir(VSData.vars.OT_EGGdir);
509 if (ischar(newdir) == 1)
510 set(handles.edit_Parameters_EGGdir, 'String', newdir);
511 VSData.vars.OT_EGGdir = newdir;
512 guidata(handles.VSHandle, VSData);
513 end
514
515
516 function edit_numSegments_Callback(hObject, eventdata, handles)
517 % hObject handle to edit_numSegments (see GCBO)
518 % eventdata reserved - to be defined in a future version of MATLAB
519 % handles structure with handles and user data (see GUIDATA)
520
521 % Hints: get(hObject,'String') returns contents of edit_numSegments as text
522 % str2double(get(hObject,'String')) returns contents of edit_numSegments as a double
523
524 VSData = guidata(handles.VSHandle);
525 num = str2double(get(hObject, 'String'));
526
527 if (~isnan(num))
528 num = round(num);
529 if (num < 1)
530 num = 1;
531 elseif (num > 999)
532 num = 999;
533 end
534
535 VSData.vars.OT_numSegments = num;
536
537 set(hObject, 'String', num2str(VSData.vars.OT_numSegments));
538 guidata(handles.VSHandle, VSData);
539 else
540 set(hObject, 'String', num2str(VSData.vars.OT_numSegments));
541 end
542
543
544 % --- Executes during object creation, after setting all properties.
545 function edit_numSegments_CreateFcn(hObject, eventdata, handles)
546 % hObject handle to edit_numSegments (see GCBO)
547 % eventdata reserved - to be defined in a future version of MATLAB
548 % handles empty - handles not created until after all CreateFcns called
549
550 % Hint: edit controls usually have a white background on Windows.
551 % See ISPC and COMPUTER.
552 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
553 set(hObject,'BackgroundColor','white');
554 end
555
556
557
558 function edit_OutputOptions_SingleFile_Callback(hObject, eventdata, handles)
559 % hObject handle to edit_OutputOptions_SingleFile (see GCBO)
560 % eventdata reserved - to be defined in a future version of MATLAB
561 % handles structure with handles and user data (see GUIDATA)
562 VSData = guidata(handles.VSHandle);
563
564 str = get(hObject, 'String');
565 [pathname, filename, ext] = fileparts(str);
566
567 if (exist(pathname, 'dir') == 7)
568 VSData.vars.OT_singleFilename = [filename ext];
569 VSData.vars.OT_Single = [pathname VSData.vars.dirdelimiter VSData.vars.OT_singleFilename];
570 end
571
572 set(hObject, 'String', VSData.vars.OT_Single);
573 guidata(handles.VSHandle, VSData);
574
575
576 % --- Executes during object creation, after setting all properties.
577 function edit_OutputOptions_SingleFile_CreateFcn(hObject, eventdata, handles)
578 % hObject handle to edit_OutputOptions_SingleFile (see GCBO)
579 % eventdata reserved - to be defined in a future version of MATLAB
580 % handles empty - handles not created until after all CreateFcns called
581
582 % Hint: edit controls usually have a white background on Windows.
583 % See ISPC and COMPUTER.
584 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
585 set(hObject,'BackgroundColor','white');
586 end
587
588
589 % --- Executes on button press in pushbutton_OutputOptions_SingleBrowse.
590 function pushbutton_OutputOptions_SingleBrowse_Callback(hObject, eventdata, handles)
591 % hObject handle to pushbutton_OutputOptions_SingleBrowse (see GCBO)
592 % eventdata reserved - to be defined in a future version of MATLAB
593 % handles structure with handles and user data (see GUIDATA)
594 VSData = guidata(handles.VSHandle);
595 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_singleFilename);
596 if (ischar(newfile) == 1)
597 set(handles.edit_OutputOptions_SingleFile, 'String', [newpath newfile]);
598 VSData.vars.OT_Single = [newpath newfile];
599 guidata(handles.VSHandle, VSData);
600 end
601
602
603 function edit_OutputOptions_F0CPPE_Callback(hObject, eventdata, handles)
604 % hObject handle to edit_OutputOptions_F0CPPE (see GCBO)
605 % eventdata reserved - to be defined in a future version of MATLAB
606 % handles structure with handles and user data (see GUIDATA)
607 VSData = guidata(handles.VSHandle);
608
609 str = get(hObject, 'String');
610 [pathname, filename, ext] = fileparts(str);
611
612 if (exist(pathname, 'dir') == 7)
613 VSData.vars.OT_F0CPPEfilename = [filename ext];
614 VSData.vars.OT_F0CPPE = [pathname VSData.vars.dirdelimiter VSData.vars.OT_F0CPPEfilename];
615 end
616
617 set(hObject, 'String', VSData.vars.OT_F0CPPE);
618 guidata(handles.VSHandle, VSData);
619
620
621 % --- Executes during object creation, after setting all properties.
622 function edit_OutputOptions_F0CPPE_CreateFcn(hObject, eventdata, handles)
623 % hObject handle to edit_OutputOptions_F0CPPE (see GCBO)
624 % eventdata reserved - to be defined in a future version of MATLAB
625 % handles empty - handles not created until after all CreateFcns called
626
627 % Hint: edit controls usually have a white background on Windows.
628 % See ISPC and COMPUTER.
629 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
630 set(hObject,'BackgroundColor','white');
631 end
632
633
634
635 function edit_OutputOptions_Formants_Callback(hObject, eventdata, handles)
636 % hObject handle to edit_OutputOptions_Formants (see GCBO)
637 % eventdata reserved - to be defined in a future version of MATLAB
638 % handles structure with handles and user data (see GUIDATA)
639 VSData = guidata(handles.VSHandle);
640
641 str = get(hObject, 'String');
642 [pathname, filename, ext] = fileparts(str);
643
644 if (exist(pathname, 'dir') == 7)
645 VSData.vars.OT_Formantsfilename = [filename ext];
646 VSData.vars.OT_Formants = [pathname VSData.vars.dirdelimiter VSData.vars.OT_Formantsfilename];
647 end
648
649 set(hObject, 'String', VSData.vars.OT_Formants);
650 guidata(handles.VSHandle, VSData);
651
652
653 % --- Executes during object creation, after setting all properties.
654 function edit_OutputOptions_Formants_CreateFcn(hObject, eventdata, handles)
655 % hObject handle to edit_OutputOptions_Formants (see GCBO)
656 % eventdata reserved - to be defined in a future version of MATLAB
657 % handles empty - handles not created until after all CreateFcns called
658
659 % Hint: edit controls usually have a white background on Windows.
660 % See ISPC and COMPUTER.
661 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
662 set(hObject,'BackgroundColor','white');
663 end
664
665
666 function edit_OutputOptions_Hx_Ax_Callback(hObject, eventdata, handles)
667 % hObject handle to edit_OutputOptions_Hx_Ax (see GCBO)
668 % eventdata reserved - to be defined in a future version of MATLAB
669 % handles structure with handles and user data (see GUIDATA)
670 VSData = guidata(handles.VSHandle);
671
672 str = get(hObject, 'String');
673 [pathname, filename, ext] = fileparts(str);
674
675 if (exist(pathname, 'dir') == 7)
676 VSData.vars.OT_Hx_Axfilename = [filename ext];
677 VSData.vars.OT_HA = [pathname VSData.vars.dirdelimiter VSData.vars.OT_Hx_Axfilename];
678 end
679
680 set(hObject, 'String', VSData.vars.OT_HA);
681 guidata(handles.VSHandle, VSData);
682
683
684 % --- Executes during object creation, after setting all properties.
685 function edit_OutputOptions_Hx_Ax_CreateFcn(hObject, eventdata, handles)
686 % hObject handle to edit_OutputOptions_Hx_Ax (see GCBO)
687 % eventdata reserved - to be defined in a future version of MATLAB
688 % handles empty - handles not created until after all CreateFcns called
689
690 % Hint: edit controls usually have a white background on Windows.
691 % See ISPC and COMPUTER.
692 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
693 set(hObject,'BackgroundColor','white');
694 end
695
696
697
698 function edit_OutputOptions_HxHx_Callback(hObject, eventdata, handles)
699 % hObject handle to edit_OutputOptions_HxHx (see GCBO)
700 % eventdata reserved - to be defined in a future version of MATLAB
701 % handles structure with handles and user data (see GUIDATA)
702 VSData = guidata(handles.VSHandle);
703
704 str = get(hObject, 'String');
705 [pathname, filename, ext] = fileparts(str);
706
707 if (exist(pathname, 'dir') == 7)
708 VSData.vars.OT_HxHxfilename = [filename ext];
709 VSData.vars.OT_HxHx = [pathname VSData.vars.dirdelimiter VSData.vars.OT_HxHxfilename];
710 end
711
712 set(hObject, 'String', VSData.vars.OT_HxHx);
713 guidata(handles.VSHandle, VSData);
714
715
716 % --- Executes during object creation, after setting all properties.
717 function edit_OutputOptions_HxHx_CreateFcn(hObject, eventdata, handles)
718 % hObject handle to edit_OutputOptions_HxHx (see GCBO)
719 % eventdata reserved - to be defined in a future version of MATLAB
720 % handles empty - handles not created until after all CreateFcns called
721
722 % Hint: edit controls usually have a white background on Windows.
723 % See ISPC and COMPUTER.
724 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
725 set(hObject,'BackgroundColor','white');
726 end
727
728
729
730 function edit_OutputOptions_HxAx_Callback(hObject, eventdata, handles)
731 % hObject handle to edit_OutputOptions_HxAx (see GCBO)
732 % eventdata reserved - to be defined in a future version of MATLAB
733 % handles structure with handles and user data (see GUIDATA)
734 VSData = guidata(handles.VSHandle);
735
736 str = get(hObject, 'String');
737 [pathname, filename, ext] = fileparts(str);
738
739 if (exist(pathname, 'dir') == 7)
740 VSData.vars.OT_HxAxfilename = [filename ext];
741 VSData.vars.OT_HxAx = [pathname VSData.vars.dirdelimiter VSData.vars.OT_HxAxfilename];
742 end
743
744 set(hObject, 'String', VSData.vars.OT_HxAx);
745 guidata(handles.VSHandle, VSData);
746
747
748 % --- Executes during object creation, after setting all properties.
749 function edit_OutputOptions_HxAx_CreateFcn(hObject, eventdata, handles)
750 % hObject handle to edit_OutputOptions_HxAx (see GCBO)
751 % eventdata reserved - to be defined in a future version of MATLAB
752 % handles empty - handles not created until after all CreateFcns called
753
754 % Hint: edit controls usually have a white background on Windows.
755 % See ISPC and COMPUTER.
756 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
757 set(hObject,'BackgroundColor','white');
758 end
759
760
761 % --- Executes on button press in pushbutton_OO_F0CPPEBrowse.
762 function pushbutton_OO_F0CPPEBrowse_Callback(hObject, eventdata, handles)
763 % hObject handle to pushbutton_OO_F0CPPEBrowse (see GCBO)
764 % eventdata reserved - to be defined in a future version of MATLAB
765 % handles structure with handles and user data (see GUIDATA)
766 VSData = guidata(handles.VSHandle);
767 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_F0CPPEfilename);
768 if (ischar(newfile) == 1)
769 set(handles.edit_OutputOptions_F0CPPE, 'String', [newpath newfile]);
770 VSData.vars.OT_F0CPPE = [newpath newfile];
771 guidata(handles.VSHandle, VSData);
772 end
773
774
775 % --- Executes on button press in pushbutton_OO_FormantsBrowse.
776 function pushbutton_OO_FormantsBrowse_Callback(hObject, eventdata, handles)
777 % hObject handle to pushbutton_OO_FormantsBrowse (see GCBO)
778 % eventdata reserved - to be defined in a future version of MATLAB
779 % handles structure with handles and user data (see GUIDATA)
780 VSData = guidata(handles.VSHandle);
781 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_Formantsfilename);
782 if (ischar(newfile) == 1)
783 set(handles.edit_OutputOptions_Formants, 'String', [newpath newfile]);
784 VSData.vars.OT_Formants = [newpath newfile];
785 guidata(handles.VSHandle, VSData);
786 end
787
788
789 % --- Executes on button press in pushbutton_OO_Hx_AxBrowse.
790 function pushbutton_OO_Hx_AxBrowse_Callback(hObject, eventdata, handles)
791 % hObject handle to pushbutton_OO_Hx_AxBrowse (see GCBO)
792 % eventdata reserved - to be defined in a future version of MATLAB
793 % handles structure with handles and user data (see GUIDATA)
794 VSData = guidata(handles.VSHandle);
795 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_Hx_Axfilename);
796 if (ischar(newfile) == 1)
797 set(handles.edit_OutputOptions_Hx_Ax, 'String', [newpath newfile]);
798 VSData.vars.OT_HA = [newpath newfile];
799 guidata(handles.VSHandle, VSData);
800 end
801
802
803 % --- Executes on button press in pushbutton_OO_HxHxBrowse.
804 function pushbutton_OO_HxHxBrowse_Callback(hObject, eventdata, handles)
805 % hObject handle to pushbutton_OO_HxHxBrowse (see GCBO)
806 % eventdata reserved - to be defined in a future version of MATLAB
807 % handles structure with handles and user data (see GUIDATA)
808 VSData = guidata(handles.VSHandle);
809 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_HxHxfilename);
810 if (ischar(newfile) == 1)
811 set(handles.edit_OutputOptions_HxHx, 'String', [newpath newfile]);
812 VSData.vars.OT_HxHx = [newpath newfile];
813 guidata(handles.VSHandle, VSData);
814 end
815
816
817 % --- Executes on button press in pushbutton_OO_HxAxBrowse.
818 function pushbutton_OO_HxAxBrowse_Callback(hObject, eventdata, handles)
819 % hObject handle to pushbutton_OO_HxAxBrowse (see GCBO)
820 % eventdata reserved - to be defined in a future version of MATLAB
821 % handles structure with handles and user data (see GUIDATA)
822 VSData = guidata(handles.VSHandle);
823 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_HxAxfilename);
824 if (ischar(newfile) == 1)
825 set(handles.edit_OutputOptions_HxAx, 'String', [newpath newfile]);
826 VSData.vars.OT_HxAx = [newpath newfile];
827 guidata(handles.VSHandle, VSData);
828 end
829
830
831 function edit_OutputOptions_EGG_Callback(hObject, eventdata, handles)
832 % hObject handle to edit_OutputOptions_EGG (see GCBO)
833 % eventdata reserved - to be defined in a future version of MATLAB
834 % handles structure with handles and user data (see GUIDATA)
835 VSData = guidata(handles.VSHandle);
836
837 str = get(hObject, 'String');
838 [pathname, filename, ext] = fileparts(str);
839
840 if (exist(pathname, 'dir') == 7)
841 VSData.vars.OT_EGGfilename = [filename ext];
842 VSData.vars.OT_EGG = [pathname VSData.vars.dirdelimiter VSData.vars.OT_EGGfilename];
843 end
844
845 set(hObject, 'String', VSData.vars.OT_EGG);
846 guidata(handles.VSHandle, VSData);
847
848
849 % --- Executes during object creation, after setting all properties.
850 function edit_OutputOptions_EGG_CreateFcn(hObject, eventdata, handles)
851 % hObject handle to edit_OutputOptions_EGG (see GCBO)
852 % eventdata reserved - to be defined in a future version of MATLAB
853 % handles empty - handles not created until after all CreateFcns called
854
855 % Hint: edit controls usually have a white background on Windows.
856 % See ISPC and COMPUTER.
857 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
858 set(hObject,'BackgroundColor','white');
859 end
860
861
862 % --- Executes on button press in pushbutton_OO_EGGBrowse.
863 function pushbutton_OO_EGGBrowse_Callback(hObject, eventdata, handles)
864 % hObject handle to pushbutton_OO_EGGBrowse (see GCBO)
865 % eventdata reserved - to be defined in a future version of MATLAB
866 % handles structure with handles and user data (see GUIDATA)
867 VSData = guidata(handles.VSHandle);
868 [newfile newpath] = uiputfile({'*.txt', '*.txt'}, 'Select Output File', VSData.vars.OT_EGGfilename);
869 if (ischar(newfile) == 1)
870 set(handles.edit_OutputOptions_EGG, 'String', [newpath newfile]);
871 VSData.vars.OT_EGG = [newpath newfile];
872 guidata(handles.VSHandle, VSData);
873 end
874
875 % --- Executes on button press in togglebutton_Start.
876 function togglebutton_Start_Callback(hObject, eventdata, handles)
877 % hObject handle to togglebutton_Start (see GCBO)
878 % eventdata reserved - to be defined in a future version of MATLAB
879 % handles structure with handles and user data (see GUIDATA)
880
881 % Hint: get(hObject,'Value') returns toggle state of togglebutton_Start
882 if (get(hObject, 'Value') == 1) % start writing output
883 set(hObject, 'String', 'Processing...', 'ForegroundColor', 'red');
884
885 OutputToText(handles);
886 set(hObject, 'String', 'Start!', 'ForegroundColor', 'black', 'Value', 0);
887
888 end
889
890
891
892
893 % --- Executes on button press in checkbox_Parameters_includeTextgrids.
894 function checkbox_Parameters_includeTextgrids_Callback(hObject, eventdata, handles)
895 % hObject handle to checkbox_Parameters_includeTextgrids (see GCBO)
896 % eventdata reserved - to be defined in a future version of MATLAB
897 % handles structure with handles and user data (see GUIDATA)
898
899 VSData = guidata(handles.VSHandle);
900 VSData.vars.OT_includeTextgridLabels = get(hObject, 'Value');
901 guidata(handles.VSHandle, VSData);
902
903
904
905 function segments_buttongroup_SelectionChangeFcn(hObject, eventdata)
906 handles = guidata(hObject);
907 VSData = guidata(handles.VSHandle);
908
909 switch (get(eventdata.NewValue, 'Tag'))
910 case 'radiobutton_noSegments'
911 VSData.vars.OT_noSegments = 1;
912 VSData.vars.OT_useSegments = 0;
913 set(handles.edit_numSegments, 'Enable', 'Off');
914 case 'radiobutton_useSegments'
915 VSData.vars.OT_noSegments = 0;
916 VSData.vars.OT_useSegments = 1;
917 set(handles.edit_numSegments, 'Enable', 'On');
918 end
919 guidata(handles.VSHandle, VSData);
920
921
922 %
923 function outputoptions_buttongroup_SelectionChangeFcn(hObject, eventdata)
924 handles = guidata(hObject);
925 VSData = guidata(handles.VSHandle);
926
927 switch (get(eventdata.NewValue, 'Tag'))
928 case 'radiobutton_Singlefile'
929 VSData.vars.OT_singleFile = 1;
930 VSData.vars.OT_multipleFiles = 0;
931
932 set(handles.edit_OutputOptions_SingleFile, 'Enable', 'On');
933 set(handles.pushbutton_OutputOptions_SingleBrowse, 'Enable', 'On');
934
935 set(handles.edit_OutputOptions_F0CPPE, 'Enable', 'Off');
936 set(handles.edit_OutputOptions_Formants, 'Enable', 'Off');
937 set(handles.edit_OutputOptions_Hx_Ax, 'Enable', 'Off');
938 set(handles.edit_OutputOptions_HxHx, 'Enable', 'Off');
939 set(handles.edit_OutputOptions_HxAx, 'Enable', 'Off');
940 set(handles.edit_OutputOptions_EGG, 'Enable', 'Off');
941
942 set(handles.pushbutton_OO_F0CPPEBrowse, 'Enable', 'Off');
943 set(handles.pushbutton_OO_FormantsBrowse, 'Enable', 'Off');
944 set(handles.pushbutton_OO_Hx_AxBrowse, 'Enable', 'Off');
945 set(handles.pushbutton_OO_HxHxBrowse, 'Enable', 'Off');
946 set(handles.pushbutton_OO_HxAxBrowse, 'Enable', 'Off');
947 set(handles.pushbutton_OO_EGGBrowse, 'Enable', 'Off');
948
949 case 'radiobutton_Multiplefiles'
950 VSData.vars.OT_singleFile = 0;
951 VSData.vars.OT_multipleFiles = 1;
952
953 set(handles.edit_OutputOptions_SingleFile, 'Enable', 'Off');
954 set(handles.pushbutton_OutputOptions_SingleBrowse, 'Enable', 'Off');
955
956 set(handles.edit_OutputOptions_F0CPPE, 'Enable', 'On');
957 set(handles.edit_OutputOptions_Formants, 'Enable', 'On');
958 set(handles.edit_OutputOptions_Hx_Ax, 'Enable', 'On');
959 set(handles.edit_OutputOptions_HxHx, 'Enable', 'On');
960 set(handles.edit_OutputOptions_HxAx, 'Enable', 'On');
961 set(handles.edit_OutputOptions_EGG, 'Enable', 'On');
962
963 set(handles.pushbutton_OO_F0CPPEBrowse, 'Enable', 'On');
964 set(handles.pushbutton_OO_FormantsBrowse, 'Enable', 'On');
965 set(handles.pushbutton_OO_Hx_AxBrowse, 'Enable', 'On');
966 set(handles.pushbutton_OO_HxHxBrowse, 'Enable', 'On');
967 set(handles.pushbutton_OO_HxAxBrowse, 'Enable', 'On');
968 set(handles.pushbutton_OO_EGGBrowse, 'Enable', 'On');
969 end
970 guidata(handles.VSHandle, VSData);
971
972
973 % --- Executes on selection change in listbox_Parameters_matfilelist.
974 function listbox_Parameters_matfilelist_Callback(hObject, eventdata, handles)
975 % hObject handle to listbox_Parameters_matfilelist (see GCBO)
976 % eventdata reserved - to be defined in a future version of MATLAB
977 % handles structure with handles and user data (see GUIDATA)
978
979 % Hints: contents = get(hObject,'String') returns listbox_Parameters_matfilelist contents as cell array
980 % contents{get(hObject,'Value')} returns selected item from listbox_Parameters_matfilelist
981
982
983 % --- Executes during object creation, after setting all properties.
984 function listbox_Parameters_matfilelist_CreateFcn(hObject, eventdata, handles)
985 % hObject handle to listbox_Parameters_matfilelist (see GCBO)
986 % eventdata reserved - to be defined in a future version of MATLAB
987 % handles empty - handles not created until after all CreateFcns called
988
989 % Hint: listbox controls usually have a white background on Windows.
990 % See ISPC and COMPUTER.
991 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
992 set(hObject,'BackgroundColor','white');
993 end
994
995
996 % --- Executes on button press in checkbox_Parameters_includesubdir.
997 function checkbox_Parameters_includesubdir_Callback(hObject, eventdata, handles)
998 % hObject handle to checkbox_Parameters_includesubdir (see GCBO)
999 % eventdata reserved - to be defined in a future version of MATLAB
1000 % handles structure with handles and user data (see GUIDATA)
1001
1002 VSData = guidata(handles.VSHandle);
1003 VSData.vars.OT_includesubdir = get(hObject, 'Value');
1004 guidata(handles.VSHandle, VSData);
1005 if (VSData.vars.OT_includesubdir == 1)
1006 func_setlistbox(handles.listbox_Parameters_matfilelist, VSData.vars.OT_matdir, 'recurse', VSData.vars, '*.mat');
1007 else
1008 func_setlistbox(handles.listbox_Parameters_matfilelist, VSData.vars.OT_matdir, 'none', VSData.vars, '*.mat');
1009 end
1010
1011
1012
1013 % executes on key press
1014 function matfiles_listbox_KeyPressFcn(hObject, eventdata)
1015 handles = guidata(hObject);
1016
1017 key = double(get(gcbf, 'CurrentCharacter'));
1018 if (gcbo == handles.listbox_Parameters_matfilelist)
1019 if (key == 127) % delete key
1020
1021 inx = get(handles.listbox_Parameters_matfilelist, 'Value');
1022 contents = get(handles.listbox_Parameters_matfilelist, 'String');
1023
1024 %nothing to do
1025 if (isempty(contents))
1026 return;
1027 end
1028
1029 newinx = setxor(inx, [1:length(contents)]);
1030
1031 newcontents = contents(newinx);
1032 set(handles.listbox_Parameters_matfilelist, 'String', newcontents);
1033
1034 if (inx(end) > length(newcontents))
1035 set(handles.listbox_Parameters_matfilelist, 'Value', length(newcontents));
1036 else
1037 set(handles.listbox_Parameters_matfilelist, 'Value', inx(end));
1038 end
1039 end
1040 end
1041
1042
1043 % this is the function that does the actual outputting of text
1044 function OutputToText(handles)
1045
1046 % check if there are any parameters and files selected
1047 if (isempty(get(handles.listbox_Parameters_paramlist, 'Value')) && get(handles.checkbox_Parameters_includeEGG, 'Value') == 0)
1048 msgbox('Error: No parameters selected.', 'Error', 'warn', 'modal');
1049 return;
1050 end
1051
1052 if (isempty(get(handles.listbox_Parameters_matfilelist, 'String')))
1053 msgbox('Error: No mat files to process.', 'Error', 'warn', 'modal');
1054 return;
1055 end
1056
1057 % get variables from the main VS window
1058 VSData = guidata(handles.VSHandle);
1059 matfilelist = get(handles.listbox_Parameters_matfilelist, 'String');
1060 contents = get(handles.listbox_Parameters_paramlist, 'String');
1061 paramlist = contents(get(handles.listbox_Parameters_paramlist, 'Value'));
1062
1063 % get the output delimiter
1064 contents = get(handles.popupmenu_Parameters_delimiter, 'String');
1065 delim = contents{VSData.vars.OT_columndelimiter};
1066 delimiter = 9; % ascii code for tab
1067 switch(delim)
1068 case {'tab'}
1069 delimiter = 9;
1070 case {'comma'}
1071 delimiter = 44; %ascii for comma
1072 case {'space'}
1073 delimiter = ' ';
1074 end
1075
1076 % check output files
1077 fids = zeros(6, 1); % these store the fids of the open files
1078 if (get(handles.radiobutton_Singlefile, 'Value') == 1) % single file
1079 fid = fopen(VSData.vars.OT_Single, 'wt');
1080
1081 if (fid == -1)
1082 msgbox('Error: Unable to open file for output.', 'Error', 'error', 'modal');
1083 return;
1084 end
1085
1086 writeFileHeaders(fid, paramlist, handles, delimiter);
1087 fids = [fid fid fid fid fid fid];
1088
1089 else % multiple files
1090 fid1 = fopen(VSData.vars.OT_F0CPPE, 'wt');
1091 fid2 = fopen(VSData.vars.OT_Formants, 'wt');
1092 fid3 = fopen(VSData.vars.OT_HA, 'wt');
1093 fid4 = fopen(VSData.vars.OT_HxHx, 'wt');
1094 fid5 = fopen(VSData.vars.OT_HxAx, 'wt');
1095
1096 if (fid1 == -1)
1097 msgbox('Error: Unable to open F0/CPP/E file for output.', 'Error', 'error', 'modal');
1098 return;
1099 end
1100
1101 if (fid2 == -1)
1102 msgbox('Error: Unable to open Formants file for output.', 'Error', 'error', 'modal');
1103 return;
1104 end
1105
1106 if (fid3 == -1)
1107 msgbox('Error: Unable to open Hx/Ax file for output.', 'Error', 'error', 'modal');
1108 return;
1109 end
1110
1111 if (fid4 == -1)
1112 msgbox('Error: Unable to open Hx-Hx file for output.', 'Error', 'error', 'modal');
1113 return;
1114 end
1115
1116 if (fid5 == -1)
1117 msgbox('Error: Unable to open Hx-Ax file for output.', 'Error', 'error', 'modal');
1118 return;
1119 end
1120
1121 fidEGG = -1;
1122 if (VSData.vars.OT_includeEGG == 1)
1123 fidEGG = fopen(VSData.vars.OT_EGG, 'wt');
1124 if (fidEGG == -1)
1125 msgbox('Error: Unable to open EGG file for output.', 'Error', 'error', 'modal');
1126 return;
1127 end
1128 end
1129
1130 fids = [fid1 fid2 fid3 fid4 fid5 fidEGG];
1131 writeFileHeaders(fids, paramlist, handles, delimiter);
1132 end
1133
1134 MBox = MessageBox;
1135 MBoxHandles = guidata(MBox);
1136 messages = cell(length(matfilelist) + 1, 1); % allocate some memory for messages
1137 errorcnt = 0;
1138 uniquefids = unique(fids); % store the number of unique fids
1139
1140 % process every file in matfilelist
1141 for k=1:length(matfilelist)
1142 matfile = [VSData.vars.OT_matdir VSData.vars.dirdelimiter matfilelist{k}];
1143 TGfile = [VSData.vars.OT_Textgriddir VSData.vars.dirdelimiter matfilelist{k}(1:end-3) 'Textgrid'];
1144 messages{k} = sprintf('%d/%d. %s: ', k, length(matfilelist), matfilelist{k});
1145 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', k);
1146 drawnow;
1147
1148 mdata = func_buildMData(matfile, VSData.vars.O_smoothwinsize);
1149
1150 frameshift = VSData.vars.frameshift; % this could be wrong if the mat file has it's own frameshift
1151 if (isfield(mdata, 'frameshift'))
1152 frameshift = mdata.frameshift;
1153 end
1154
1155 % find the max length of the data
1156 if (isfield(mdata, 'strF0'))
1157 maxlen = length(mdata.strF0) * frameshift;
1158 elseif (isfield(mdata, 'sF0'))
1159 maxlen = length(mdata.sF0) * frameshift;
1160 elseif (isfield(mdata, 'pF0'))
1161 maxlen = length(mdata.pF0) * frameshift;
1162 elseif (isfield(mdata, 'oF0'))
1163 maxlen = length(mdata.oF0) * frameshift;
1164 end
1165
1166 % load up the textgrid data, or if it doesn't exist, use the whole file
1167 if (exist(TGfile, 'file') == 0) % file not found, use start and end
1168 messages{k} = [messages{k} 'Textgrid not found - using all data points: '];
1169 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', k);
1170 drawnow;
1171
1172 start = 1;
1173 stop = maxlen;
1174 labels = {matfilelist{k}};
1175
1176 else % use textgrid start points
1177 ignorelabels = textscan(VSData.vars.TextgridIgnoreList, '%s', 'delimiter', ',');
1178 ignorelabels = ignorelabels{1};
1179
1180 [labels, start, stop] = func_readTextgrid(TGfile);
1181 labels_tmp = [];
1182 start_tmp = [];
1183 stop_tmp = [];
1184
1185 for m=1:length(VSData.vars.TextgridTierNumber)
1186 inx = VSData.vars.TextgridTierNumber(m);
1187 if (inx <= length(labels))
1188 labels_tmp = [labels_tmp; labels{inx}];
1189 start_tmp = [start_tmp; start{inx}];
1190 stop_tmp = [stop_tmp; stop{inx}];
1191 end
1192 end
1193
1194 labels = labels_tmp;
1195 start = start_tmp * 1000; % milliseconds
1196 stop = stop_tmp * 1000; % milliseconds
1197
1198 % just pull out the start/stop of the labels that aren't
1199 % ignored
1200 inx = 1:length(labels);
1201 for n=1:length(labels)
1202 switch(labels{n})
1203 case ignorelabels
1204 inx(n) = 0;
1205 end
1206 end
1207 inx = unique(inx);
1208 inx(inx == 0) = [];
1209 labels = labels(inx);
1210 start = start(inx);
1211 stop = stop(inx);
1212 end
1213
1214 % get the EGG file if requested
1215 [proceedEGG, EGGfile] = checkEGGfilename(matfilelist{k}, handles);
1216
1217 if (VSData.vars.OT_includeEGG == 1 && proceedEGG == 0)
1218 messages{k} = [messages{k} 'EGG file not found, '];
1219 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', k);
1220 drawnow;
1221 errorcnt = errorcnt + 1;
1222 end
1223
1224 if (proceedEGG)
1225 [EGGData, EGGTime] = func_readEGGfile(EGGfile, VSData.vars.EGGheaders, VSData.vars.EGGtimelabel);
1226 end
1227
1228 % assume each file has the parameters in the mat file
1229 paramlist_valid = ones(length(paramlist), 1);
1230
1231
1232 % no segments - complete dump
1233 if (VSData.vars.OT_noSegments == 1)
1234
1235 % for each label, loop through and write out the selected
1236 % parameters
1237 for n=1:length(start)
1238 sstart = round(start(n) / frameshift); % get the correct sample
1239 sstop = round(stop(n) / frameshift);
1240
1241 sstart(sstart == 0) = 1; % special case for t = 0
1242 sstop(sstop > maxlen) = maxlen; % special case for t=maxlen
1243
1244 for s=sstart:sstop
1245
1246 for m=1:length(uniquefids)
1247 if (uniquefids(m) == -1)
1248 continue;
1249 end
1250
1251 fprintf(uniquefids(m), '%s%c', matfilelist{k}, delimiter);
1252
1253 if (VSData.vars.OT_includeTextgridLabels == 1)
1254 fprintf(uniquefids(m), '%s%c', labels{n}, delimiter);
1255 fprintf(uniquefids(m), '%.3f%c', start(n), delimiter);
1256 fprintf(uniquefids(m), '%.3f%c', stop(n), delimiter);
1257 end
1258
1259 fprintf(uniquefids(m), '%.3f%c', s * frameshift, delimiter);
1260 end
1261
1262 % print out the selected params
1263 for m=1:length(paramlist)
1264 val = VSData.vars.NotANumber; % default is the NaN label
1265
1266 C = textscan(paramlist{m}, '%s %s', 'delimiter', '(');
1267 fidinx = func_getfileinx(paramlist{m});
1268 param = C{2}{1}(1:end-1);
1269 if (isfield(mdata, param))
1270 data = mdata.(param);
1271 if (length(data)==1 && isnan(data)) % guard against empty vectors
1272 paramlist_valid(m) = 0;
1273 else
1274 if (~isnan(data(s)) && ~isinf(data(s)))
1275 val = sprintf('%.3f', data(s));
1276 end
1277 end
1278 else
1279 if (paramlist_valid(m) == 1)
1280 messages{k} = [messages{k} param ' not found, '];
1281 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', k);
1282 drawnow;
1283 errorcnt = errorcnt + 1;
1284 paramlist_valid(m) = 0;
1285 end
1286 end
1287
1288 fprintf(fids(fidinx), '%s%c', val, delimiter);
1289 end
1290
1291 % for the case where EGG was requested, but no EGG file was found
1292 if (VSData.vars.OT_includeEGG == 1 && proceedEGG == 0)
1293 fidinx = 6;
1294 EGGheaders = textscan(VSData.vars.EGGheaders, '%s', 'delimiter', ',');
1295 EGGheaders = EGGheaders{1};
1296
1297 for m=1:length(EGGheaders)
1298 fprintf(fids(fidinx), '%s%c', VSData.vars.NotANumber, delimiter);
1299 end
1300 end
1301
1302
1303 % process EGG stuff
1304 if (proceedEGG)
1305 fidinx = 6;
1306
1307 % find the time segment from EGGTime, use that to index
1308 % EGGData
1309 t = s * frameshift; % this is the time in ms. Get the closest EGGTime to t
1310 [val, s_EGG] = min(abs(EGGTime - t));
1311
1312 if (abs(t - EGGTime(s_EGG)) / t > 0.05) % if t_EGG is more than 5% away from t, it is not correct
1313 for m=1:length(EGGData)
1314 fprintf(fids(fidinx), '%s%c', VSData.vars.NotANumber, delimiter);
1315 end
1316 else
1317 for m=1:length(EGGData)
1318 fprintf(fids(fidinx), '%.3f%c', EGGData{m}(s_EGG), delimiter);
1319 end
1320 end
1321 end
1322
1323 % finally, write out new line
1324 for m=1:length(uniquefids)
1325 if (uniquefids(m) == -1)
1326 continue;
1327 end
1328 fprintf(uniquefids(m), '\n');
1329 end
1330
1331 end
1332
1333 end
1334
1335
1336 % outputting with segments
1337 else
1338 Nseg = str2double(get(handles.edit_numSegments, 'String'));
1339
1340 % for each segment, print out overall mean, then parts mean
1341 for n=1:length(start)
1342
1343 % print out the header stuff
1344 for m=1:length(uniquefids)
1345 if (uniquefids(m) == -1)
1346 continue;
1347 end
1348
1349 fprintf(uniquefids(m), '%s%c', matfilelist{k}, delimiter);
1350
1351 if (VSData.vars.OT_includeTextgridLabels == 1)
1352 fprintf(uniquefids(m), '%s%c', labels{n}, delimiter);
1353 fprintf(uniquefids(m), '%.3f%c', start(n), delimiter);
1354 fprintf(uniquefids(m), '%.3f%c', stop(n), delimiter);
1355 end
1356
1357 end
1358
1359 % get array of start and stop times for the segments. First one
1360 % is the total mean
1361 tsegs = linspace(start(n), stop(n), Nseg+1);
1362 tstart = zeros(Nseg+1, 1);
1363 tstop = zeros(Nseg+1, 1);
1364
1365 tstart(1) = start(n);
1366 tstop(1) = stop(n);
1367 tstart(2:end) = tsegs(1:Nseg);
1368 tstop(2:end) = tsegs(2:Nseg+1);
1369
1370 % get the sample equivalents
1371 sstart = round(tstart ./ frameshift);
1372 sstop = round(tstop ./ frameshift);
1373
1374 % don't output segments if Nseg == 1
1375 if (Nseg == 1)
1376 sstart = sstart(1);
1377 sstop = sstop(1);
1378 end
1379
1380 % guard against 0 and maxlen
1381 sstart(sstart == 0) = 1;
1382 sstop(sstop > maxlen) = maxlen;
1383
1384 for m=1:length(paramlist)
1385 val = VSData.vars.NotANumber; % default value is no value
1386
1387 fidinx = func_getfileinx(paramlist{m});
1388 C = textscan(paramlist{m}, '%s %s', 'delimiter', '(');
1389 param = C{2}{1}(1:end-1);
1390 if (isfield(mdata, param))
1391 data = mdata.(param);
1392
1393 for p=1:length(sstart)
1394 if (length(data)==1 && isnan(data))
1395 paramlist_valid(m) = 0;
1396 else
1397 dataseg = data(sstart(p):sstop(p));
1398 mdataseg = mean(dataseg(~isnan(dataseg) & ~isinf(dataseg)));
1399 if (~isempty(mdataseg) && ~isnan(mdataseg) && ~isinf(mdataseg))
1400 val = sprintf('%.3f', mdataseg);
1401 end
1402 end
1403 fprintf(fids(fidinx), '%s%c', val, delimiter);
1404 end
1405 else
1406 if (paramlist_valid(m) == 1)
1407 messages{k} = [messages{k} param ' not found, '];
1408 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', k);
1409 drawnow;
1410 errorcnt = errorcnt + 1;
1411 paramlist_valid(m) = 0;
1412 end
1413
1414 for p=1:length(sstart)
1415 fprintf(fids(fidinx), '%s%c', val, delimiter);
1416 end
1417 end
1418
1419 end
1420
1421
1422 % this case if for when the EGG was requested, but no egg file
1423 % was found
1424 if (VSData.vars.OT_includeEGG == 1 && proceedEGG == 0)
1425 fidinx = 6;
1426 EGGheaders = textscan(VSData.vars.EGGheaders, '%s', 'delimiter', ',');
1427 EGGheaders = EGGheaders{1};
1428 for m=1:length(EGGheaders)
1429 for p=1:length(tstart)
1430 fprintf(fids(fidinx), '%s%c', VSData.vars.NotANumber, delimiter);
1431 end
1432 end
1433 end
1434
1435 % process EGG stuff
1436 if (proceedEGG)
1437 fidinx = 6;
1438
1439 for m=1:length(EGGData)
1440 for p=1:length(tstart)
1441 EGGInx = (EGGTime >= tstart(p)) & (EGGTime <= tstop(p));
1442 meanval = mean(EGGData{m}(EGGInx));
1443 if (~isempty(meanval) && ~isnan(meanval) && ~isinf(meanval))
1444 val = sprintf('%.3f', meanval);
1445 else
1446 val = VSData.vars.NotANumber;
1447 end
1448 fprintf(fids(fidinx), '%s%c', val, delimiter);
1449 end
1450 end
1451 end
1452
1453 % finally, write out new line
1454 for m=1:length(uniquefids)
1455 if (uniquefids(m) == -1)
1456 continue;
1457 end
1458 fprintf(uniquefids(m), '\n');
1459 end
1460
1461 end
1462 end
1463 end
1464
1465 for k=1:length(uniquefids)
1466 if (uniquefids(k) == -1)
1467 continue;
1468 end
1469 fclose(uniquefids(k));
1470 end
1471
1472 if (errorcnt > 0)
1473 messages{length(matfilelist)+1} = sprintf('Completed: %d parameters not found.', errorcnt);
1474 else
1475 messages{length(matfilelist)+1} = sprintf('Completed.');
1476 end
1477 set(MBoxHandles.listbox_messages, 'String', messages, 'Value', length(matfilelist)+1);
1478
1479 % allow the MBox to close
1480 set(MBoxHandles.pushbutton_close, 'Enable', 'on');
1481 set(MBoxHandles.pushbutton_stop, 'Enable', 'off');
1482
1483
1484
1485 % write headers to files
1486 function writeFileHeaders(fids, paramlist, handles, delimiter)
1487 VSData = guidata(handles.VSHandle);
1488
1489 % write out the filename and textgrid labels if required
1490 for k=1:length(fids)
1491 if (fids(k) == -1)
1492 continue;
1493 end
1494
1495 fprintf(fids(k), 'Filename%c', delimiter);
1496
1497 if (VSData.vars.OT_includeTextgridLabels == 1)
1498 fprintf(fids(k), 'Label%c', delimiter);
1499 fprintf(fids(k), 'seg_Start%c', delimiter);
1500 fprintf(fids(k), 'seg_End%c', delimiter);
1501 end
1502
1503 % only print a time stamp when doing complete dumps
1504 if (VSData.vars.OT_noSegments == 1)
1505 fprintf(fids(k), 't_ms%c', delimiter);
1506 end
1507 end
1508
1509 % make the file ids the same length as using multiple files
1510 if (length(fids)==1)
1511 if (VSData.vars.OT_includeEGG)
1512 fids = [fids fids fids fids fids fids];
1513 else
1514 fids = [fids fids fids fids fids -1];
1515 end
1516 end
1517
1518 % separate case for complete data dump
1519 if (VSData.vars.OT_noSegments == 1)
1520 for k=1:length(paramlist)
1521 fidinx = func_getfileinx(paramlist{k});
1522 C = textscan(paramlist{k}, '%s %s', 'delimiter', '(');
1523 fprintf(fids(fidinx), '%s%c', C{2}{1}(1:end-1), delimiter);
1524 end
1525
1526 if (VSData.vars.OT_includeEGG)
1527 fidinx = 6;
1528 C = textscan(VSData.vars.EGGheaders, '%s', 'delimiter', ',');
1529 for n=1:length(C{1})
1530 fprintf(fids(fidinx), '%s%c', C{1}{n}, delimiter);
1531 end
1532 end
1533
1534 % finally, write out new line
1535 fids = unique(fids);
1536 for k=1:length(fids)
1537 if (fids(k) == -1)
1538 continue;
1539 end
1540 fprintf(fids(k), '\n');
1541 end
1542
1543 % using segments
1544 else
1545 Nseg = str2double(get(handles.edit_numSegments, 'String'));
1546
1547 % for each parameter, print the mean, followed by the means of each
1548 % segment
1549 for k=1:length(paramlist)
1550 fidinx = func_getfileinx(paramlist{k});
1551 C = textscan(paramlist{k}, '%s %s', 'delimiter', '(');
1552 label = C{2}{1}(1:end-1);
1553 fprintf(fids(fidinx), '%s_mean%c', label, delimiter);
1554 if (Nseg > 1)
1555 for n=1:Nseg
1556 segno = sprintf('%3d', n);
1557 segno = strrep(segno, ' ', '0');
1558 fprintf(fids(fidinx), '%s_means%s%c', label, segno, delimiter);
1559 end
1560 end
1561 end
1562
1563 if (VSData.vars.OT_includeEGG)
1564 fidinx = 6;
1565 C = textscan(VSData.vars.EGGheaders, '%s', 'delimiter', ',');
1566 for n=1:length(C{1})
1567 fprintf(fids(fidinx), '%s_mean%c', C{1}{n}, delimiter);
1568
1569 if (Nseg > 1)
1570 for m=1:Nseg
1571 segno = sprintf('%3d', m);
1572 segno = strrep(segno, ' ', '0');
1573 fprintf(fids(fidinx), '%s_means%s%c', C{1}{n}, segno, delimiter);
1574 end
1575 end
1576 end
1577 end
1578
1579 % finally, write out a new line
1580 fids = unique(fids);
1581 for k=1:length(fids)
1582 if (fids(k) == -1)
1583 continue;
1584 end
1585 fprintf(fids(k), '\n');
1586 end
1587
1588
1589 end
1590
1591
1592
1593 function [proceedEGG, EGGfile] = checkEGGfilename(matfile, handles)
1594 VSData = guidata(handles.VSHandle);
1595
1596 if (VSData.vars.OT_includeEGG == 0)
1597 proceedEGG = 0;
1598 EGGfile = '';
1599 return;
1600 end
1601
1602 % deal with the filename stupidity that is PCQuirer
1603 VSData = guidata(handles.VSHandle);
1604
1605 EGGfile = [VSData.vars.OT_EGGdir VSData.vars.dirdelimiter matfile(1:end-3) 'egg']; % attempt to open .egg
1606 if (exist(EGGfile, 'file') == 0)
1607 proceedEGG = 0;
1608
1609 if (length(matfile) > 10)
1610 if (strcmpi(matfile(end-9:end-4), '_Audio')) % case insensitive
1611 EGGfile = [VSData.vars.OT_EGGdir VSData.vars.dirdelimiter matfile(1:end-9), 'ch1.egg']; % try with ch1 first
1612
1613 if (exist(EGGfile, 'file') == 0)
1614 EGGfile = [VSData.vars.OT_EGGdir VSData.vars.dirdelimiter matfile(1:end-10) '.egg']; % next try with .egg w/o _Audio
1615 if (exist(EGGfile, 'file') == 0)
1616 proceedEGG = 0;
1617 else
1618 proceedEGG = 1;
1619 end
1620 else
1621 proceedEGG = 1;
1622 end
1623
1624 end
1625 end
1626 else
1627 proceedEGG = 1;
1628 end
1629
1630
1631
1632
1633