1 | %'series': master function associated to the GUI series.m for analysis field series |
---|
2 | %------------------------------------------------------------------------ |
---|
3 | % function varargout = series(varargin) |
---|
4 | % associated with the GUI series.fig |
---|
5 | % |
---|
6 | %INPUT |
---|
7 | % param: structure with input parameters (link with the GUI uvmat) |
---|
8 | % .menu_coord_str: string for the TransformName (menu for coordinate transforms) |
---|
9 | % .menu_coord_val: value for TransformName (menu for coordinate transforms) |
---|
10 | % .FileName: input file name |
---|
11 | % .FileName_1: second input file name |
---|
12 | % .list_field: menu of input fields |
---|
13 | % .index_fields: chosen index |
---|
14 | % .civ1=0 or 1, .interp1, ... : input civ field type |
---|
15 | % |
---|
16 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
17 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
18 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
19 | % This file is part of the toolbox UVMAT. |
---|
20 | % |
---|
21 | % UVMAT is free software; you can redistribute it and/or modify |
---|
22 | % it under the terms of the GNU General Public License as published by |
---|
23 | % the Free Software Foundation; either version 2 of the License, or |
---|
24 | % (at your option) any later version. |
---|
25 | % |
---|
26 | % UVMAT is distributed in the hope that it will be useful, |
---|
27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
29 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
30 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
31 | |
---|
32 | %------------------------------------------------------------------------ |
---|
33 | %------------------------------------------------------------------------ |
---|
34 | % I - MAIN FUNCTION series |
---|
35 | %------------------------------------------------------------------------ |
---|
36 | %------------------------------------------------------------------------ |
---|
37 | function varargout = series(varargin) |
---|
38 | |
---|
39 | % Begin initialization code - DO NOT EDIT |
---|
40 | gui_Singleton = 1; |
---|
41 | gui_State = struct('gui_Name', mfilename, ... |
---|
42 | 'gui_Singleton', gui_Singleton, ... |
---|
43 | 'gui_OpeningFcn', @series_OpeningFcn, ... |
---|
44 | 'gui_OutputFcn', @series_OutputFcn, ... |
---|
45 | 'gui_LayoutFcn', [] , ... |
---|
46 | 'gui_Callback', []); |
---|
47 | if nargin && ischar(varargin{1}) |
---|
48 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
49 | end |
---|
50 | |
---|
51 | if nargout |
---|
52 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
53 | else |
---|
54 | gui_mainfcn(gui_State, varargin{:}); |
---|
55 | end |
---|
56 | % End initialization code - DO NOT EDIT |
---|
57 | |
---|
58 | %-------------------------------------------------------------------------- |
---|
59 | % --- Executes just before series is made visible. |
---|
60 | %-------------------------------------------------------------------------- |
---|
61 | function series_OpeningFcn(hObject, eventdata, handles,param) |
---|
62 | global nb_builtin_ACTION nb_builtin_transform |
---|
63 | % Choose default command line output for series |
---|
64 | handles.output = hObject; |
---|
65 | % Update handles structure |
---|
66 | guidata(hObject, handles); |
---|
67 | %default initial parameters |
---|
68 | drawnow |
---|
69 | set(hObject,'Units','pixels') |
---|
70 | set(handles.PairString,'ColumnEditable',logical(0)) |
---|
71 | set(handles.PairString,'ColumnFormat',{'char'}) |
---|
72 | set(handles.PairString,'ColumnWidth',{60}) |
---|
73 | set(handles.PairString,'Data',{''}) |
---|
74 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) |
---|
75 | dir_perso=prefdir; |
---|
76 | test_profil_perso=0; |
---|
77 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
78 | if exist(profil_perso,'file') |
---|
79 | h=load (profil_perso); |
---|
80 | if isfield(h,'MenuFile') |
---|
81 | for ifile=1:min(length(h.MenuFile),5) |
---|
82 | eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) |
---|
83 | end |
---|
84 | end |
---|
85 | test_profil_perso=1; |
---|
86 | end |
---|
87 | |
---|
88 | %check default input data |
---|
89 | if ~exist('param','var') |
---|
90 | param=[]; %default |
---|
91 | end |
---|
92 | |
---|
93 | %% file name and browser initialisation |
---|
94 | if isfield(param,'menu_coord_str') |
---|
95 | set(handles.TransformName,'String',param.menu_coord_str) |
---|
96 | end |
---|
97 | if isfield(param,'menu_coord_val') |
---|
98 | set(handles.TransformName,'Value',param.menu_coord_val); |
---|
99 | else |
---|
100 | set(handles.TransformName,'Value',1);%default |
---|
101 | end |
---|
102 | if isfield(param,'FileName') |
---|
103 | InputTable={'','','','',''}; |
---|
104 | set(handles.InputTable,'Data',InputTable) |
---|
105 | if isfield(param,'FileName_1') |
---|
106 | display_file_name(handles,param.FileName_1,0) |
---|
107 | display_file_name(handles,param.FileName,1) |
---|
108 | else |
---|
109 | display_file_name(handles,param.FileName,0) |
---|
110 | end |
---|
111 | end |
---|
112 | if isfield(param,'incr_i') |
---|
113 | set(handles.num_incr_i,'String',num2str(param.incr_i)) |
---|
114 | end |
---|
115 | if isfield(param,'incr_j') |
---|
116 | set(handles.num_incr_j,'String',num2str(param.incr_j)) |
---|
117 | end |
---|
118 | |
---|
119 | %% fields input initialisation |
---|
120 | if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) |
---|
121 | set(handles.FieldName,'String',param.list_fields);% list menu fields |
---|
122 | set(handles.FieldName,'Value',param.index_fields);% selected string index |
---|
123 | % FieldCell{1}=param.list_fields{param.index_fields}; |
---|
124 | end |
---|
125 | |
---|
126 | %loads the information stored in prefdir to initiate the list of ActionName functions |
---|
127 | fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; |
---|
128 | transform_menu={'';'phys';'px';'phys_polar'}; |
---|
129 | nb_builtin_ACTION=numel(fct_menu); %number of functions |
---|
130 | nb_transform=numel(transform_menu); |
---|
131 | [path_series,name,ext]=fileparts(which('series')); |
---|
132 | path_series=fullfile(path_series,'series');%path of the function 'series' |
---|
133 | addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory) |
---|
134 | path_transform=fullfile(path_series,'transform_field');%path to the field transform functions |
---|
135 | for ilist=1:length(fct_menu) |
---|
136 | fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' |
---|
137 | end |
---|
138 | |
---|
139 | %% TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions |
---|
140 | menu_str={'';'sub_field';'phys';'phys_polar'}; |
---|
141 | nb_builtin_transform=numel(menu_str); %number of functions |
---|
142 | [path_uvmat,name,ext]=fileparts(which('uvmat')); |
---|
143 | addpath(fullfile(path_uvmat,'transform_field')) |
---|
144 | fct_handle{1,1}=[]; |
---|
145 | testexist(1)=1; |
---|
146 | for ilist=2:length(menu_str) |
---|
147 | if exist(menu_str{ilist},'file') |
---|
148 | fct_handle{ilist,1}=str2func(menu_str{ilist}); |
---|
149 | testexist(ilist)=1; |
---|
150 | else |
---|
151 | testexist(ilist)=0; |
---|
152 | end |
---|
153 | end |
---|
154 | rmpath(fullfile(path_uvmat,'transform_field')) |
---|
155 | |
---|
156 | %% read the list of transform functions stored in the personal file 'uvmat_perso.mat' in prefdir |
---|
157 | if test_profil_perso |
---|
158 | if isfield(h,'series_fct') && iscell(h.series_fct) |
---|
159 | for ilist=1:length(h.series_fct) |
---|
160 | [path,file]=fileparts(h.series_fct{ilist}); |
---|
161 | fct_path=[fct_path; {path}];%concatene the list of paths |
---|
162 | fct_menu=[fct_menu; {file}]; |
---|
163 | end |
---|
164 | end |
---|
165 | if isfield(h,'transform_fct') && iscell(h.transform_fct) |
---|
166 | for ilist=1:length(h.transform_fct); |
---|
167 | [path,file]=fileparts(h.transform_fct{ilist}); |
---|
168 | addpath(path) |
---|
169 | if exist(file,'file') |
---|
170 | h_func=str2func(file); |
---|
171 | testexist=[testexist 1]; |
---|
172 | else |
---|
173 | h_func=[]; |
---|
174 | testexist=[testexist 0]; |
---|
175 | end |
---|
176 | fct_handle=[fct_handle; {h_func}];%concatene the list of paths |
---|
177 | rmpath(path) |
---|
178 | menu_str=[menu_str; {file}]; |
---|
179 | end |
---|
180 | end |
---|
181 | end |
---|
182 | fct_menu=[fct_menu;{'more...'}]; |
---|
183 | set(handles.ActionName,'String',fct_menu) |
---|
184 | set(handles.ActionName,'UserData',fct_path)% store the list of path in UserData of ACTION |
---|
185 | menu_str=menu_str(find(testexist)); |
---|
186 | fct_handle=fct_handle(find(testexist)); |
---|
187 | menu_str=[menu_str;{'more...'}]; |
---|
188 | set(handles.TransformName,'String',menu_str) |
---|
189 | set(handles.TransformName,'UserData',fct_handle)% store the list of path in UserData of ACTION |
---|
190 | |
---|
191 | %% Adjust the GUI according to the binaries available in PARAM.xml |
---|
192 | path_uvmat=fileparts(which('uvmat')); %path to civ |
---|
193 | addpath (path_uvmat) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory) |
---|
194 | errormsg=[];%default error message |
---|
195 | xmlfile='PARAM.xml'; |
---|
196 | if exist(xmlfile,'file') |
---|
197 | try |
---|
198 | t=xmltree(xmlfile); |
---|
199 | sparam=convert(t); |
---|
200 | catch ME |
---|
201 | errormsg={' Unable to read the file PARAM.xml defining the civx binaries:';ME.message}; |
---|
202 | end |
---|
203 | else |
---|
204 | errormsg=[xmlfile ' not found: path to civx binaries undefined']; |
---|
205 | end |
---|
206 | if ~isempty(errormsg) |
---|
207 | msgbox_uvmat('WARNING',errormsg); |
---|
208 | end |
---|
209 | test_batch=0;%default: ,no batch mode available |
---|
210 | if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') |
---|
211 | test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod |
---|
212 | end |
---|
213 | RUNVal=get(handles.RunMode,'Value'); |
---|
214 | if test_batch==0 |
---|
215 | if RUNVal>2 |
---|
216 | set(handles.RunMode,'Value',1) |
---|
217 | end |
---|
218 | set(handles.RunMode,'String',{'local';'background'}) |
---|
219 | else |
---|
220 | set(handles.RunMode,'String',{'local';'background';'cluster'}) |
---|
221 | end |
---|
222 | |
---|
223 | %------------------------------------------------------------------------ |
---|
224 | % --- Outputs from this function are returned to the command line. |
---|
225 | function varargout = series_OutputFcn(hObject, eventdata, handles) |
---|
226 | %------------------------------------------------------------------------ |
---|
227 | % varargout cell array for returning output args (see VARARGOUT); |
---|
228 | % hObject handle to figure |
---|
229 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
230 | % handles structure with handles and user data (see GUIDATA) |
---|
231 | % Get default command line output from handles structure |
---|
232 | varargout{1} = handles.output; |
---|
233 | |
---|
234 | %------------------------------------------------------------------------ |
---|
235 | %------------------------------------------------------------------------ |
---|
236 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES |
---|
237 | % automatically sets the global properties when the rootfile name is introduced |
---|
238 | % then activate the view-field actionname if selected |
---|
239 | % it is activated either by clicking on the RootPath window or by the |
---|
240 | % browser |
---|
241 | %------------------------------------------------------------------------ |
---|
242 | %------------------------------------------------------------------------ |
---|
243 | function MenuBrowse_Callback(hObject, eventdata, handles) |
---|
244 | %------------------------------------------------------------------------ |
---|
245 | InputTable=get(handles.InputTable,'Data'); |
---|
246 | if isempty(InputTable) |
---|
247 | RootPathCell={}; |
---|
248 | else |
---|
249 | RootPathCell=InputTable(:,1); |
---|
250 | end |
---|
251 | oldfile=''; %default |
---|
252 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
253 | dir_perso=prefdir; |
---|
254 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
255 | if exist(profil_perso,'file') |
---|
256 | h=load (profil_perso); |
---|
257 | if isfield(h,'filebase')&&ischar(h.filebase) |
---|
258 | oldfile=h.filebase; |
---|
259 | end |
---|
260 | if isfield(h,'RootPath')&&ischar(h.RootPath) |
---|
261 | oldfile=h.RootPath; |
---|
262 | end |
---|
263 | end |
---|
264 | else |
---|
265 | SubDirCell=InputTable(:,2); |
---|
266 | RootFileCell=InputTable(:,3); |
---|
267 | oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1}); |
---|
268 | end |
---|
269 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
270 | {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; |
---|
271 | '*.xml', '.xml files '; ... |
---|
272 | '*.xls', '.xls files '; ... |
---|
273 | '*.png','.png image files'; ... |
---|
274 | '*.tif','.tif image files'; ... |
---|
275 | '*.avi;*.AVI','.avi movie files'; ... |
---|
276 | '*.nc','.netcdf files'; ... |
---|
277 | '*.*', 'All Files (*.*)'}, ... |
---|
278 | 'Pick a file',oldfile); |
---|
279 | fileinput=[PathName FileName];%complete file name |
---|
280 | if isempty(fileinput),return;end %abandon if no file is introduced by the browser |
---|
281 | [path,name,ext]=fileparts(fileinput); |
---|
282 | if isequal(ext,'.xml') |
---|
283 | [Param,Heading]=xml2struct(fileinput); |
---|
284 | if ~strcmp(Heading,'Series') |
---|
285 | msg_box_uvmat('ERROR','xml file heading is not <Series>') |
---|
286 | else |
---|
287 | fill_GUI(Param,handles);%fill the GUI with the parameters retrieved from the xml file |
---|
288 | if isfield(Param,'CheckObject')&& Param.CheckObject |
---|
289 | set_object(Param.ProjObject) |
---|
290 | end |
---|
291 | set(handles.REFRESH,'UserData',[1:size(Param.InputTable,1)]) |
---|
292 | REFRESH_Callback([],[], handles) |
---|
293 | return |
---|
294 | end |
---|
295 | elseif isequal(ext,'.xls') |
---|
296 | msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
297 | else |
---|
298 | display_file_name(handles,fileinput,0) |
---|
299 | end |
---|
300 | |
---|
301 | % -------------------------------------------------------------------- |
---|
302 | function MenuFile_1_Callback(hObject, eventdata, handles) |
---|
303 | fileinput=get(handles.MenuFile_1,'Label'); |
---|
304 | display_file_name(handles,fileinput,0) |
---|
305 | |
---|
306 | % -------------------------------------------------------------------- |
---|
307 | function MenuFile_2_Callback(hObject, eventdata, handles) |
---|
308 | fileinput=get(handles.MenuFile_2,'Label'); |
---|
309 | display_file_name(handles,fileinput,0) |
---|
310 | |
---|
311 | % -------------------------------------------------------------------- |
---|
312 | function MenuFile_3_Callback(hObject, eventdata, handles) |
---|
313 | fileinput=get(handles.MenuFile_3,'Label'); |
---|
314 | display_file_name( handles,fileinput,0) |
---|
315 | |
---|
316 | % -------------------------------------------------------------------- |
---|
317 | function MenuFile_4_Callback(hObject, eventdata, handles) |
---|
318 | fileinput=get(handles.MenuFile_4,'Label'); |
---|
319 | display_file_name(handles,fileinput,0) |
---|
320 | |
---|
321 | % -------------------------------------------------------------------- |
---|
322 | function MenuFile_5_Callback(hObject, eventdata, handles) |
---|
323 | fileinput=get(handles.MenuFile_5,'Label'); |
---|
324 | display_file_name(handles,fileinput,0) |
---|
325 | |
---|
326 | % -------------------------------------------------------------------- |
---|
327 | function MenuBrowse_insert_Callback(hObject, eventdata, handles) |
---|
328 | InputTable=get(handles.InputTable,'Data'); |
---|
329 | RootPathCell=InputTable(:,1); |
---|
330 | SubDirCell=InputTable(:,3); |
---|
331 | RootFileCell=InputTable(:,2); |
---|
332 | oldfile=''; %default |
---|
333 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
334 | dir_perso=prefdir; |
---|
335 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
336 | if exist(profil_perso,'file') |
---|
337 | h=load (profil_perso); |
---|
338 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
339 | oldfile=h.filebase; |
---|
340 | end |
---|
341 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
342 | oldfile=h.RootPath; |
---|
343 | end |
---|
344 | end |
---|
345 | else |
---|
346 | oldfile=fullfile(RootPathCell{1},RootFileCell{1}); |
---|
347 | end |
---|
348 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
349 | {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; |
---|
350 | '*.xml', '.xml files '; ... |
---|
351 | '*.xls', '.xls files '; ... |
---|
352 | '*.png','.png image files'; ... |
---|
353 | '*.avi;*.AVI','.avi movie files'; ... |
---|
354 | '*.nc','.netcdf files'; ... |
---|
355 | '*.*', 'All Files (*.*)'}, ... |
---|
356 | 'Pick a file',oldfile); |
---|
357 | fileinput=[PathName FileName];%complete file name |
---|
358 | sizf=size(fileinput); |
---|
359 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
360 | [path,name,ext]=fileparts(fileinput); |
---|
361 | if isequal(ext,'.xml') |
---|
362 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
363 | elseif isequal(ext,'.xls') |
---|
364 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
365 | else |
---|
366 | display_file_name(handles,fileinput,'append') |
---|
367 | end |
---|
368 | |
---|
369 | % -------------------------------------------------------------------- |
---|
370 | function MenuFile_insert_1_Callback(hObject, eventdata, handles) |
---|
371 | % -------------------------------------------------------------------- |
---|
372 | fileinput=get(handles.MenuFile_insert_1,'Label'); |
---|
373 | display_file_name(handles,fileinput,'append') |
---|
374 | |
---|
375 | % -------------------------------------------------------------------- |
---|
376 | function MenuFile_insert_2_Callback(hObject, eventdata, handles) |
---|
377 | % -------------------------------------------------------------------- |
---|
378 | fileinput=get(handles.MenuFile_insert_2,'Label'); |
---|
379 | display_file_name(handles,fileinput,'append') |
---|
380 | |
---|
381 | % -------------------------------------------------------------------- |
---|
382 | function MenuFile_insert_3_Callback(hObject, eventdata, handles) |
---|
383 | % -------------------------------------------------------------------- |
---|
384 | fileinput=get(handles.MenuFile_insert_3,'Label'); |
---|
385 | display_file_name( handles,fileinput,'append') |
---|
386 | |
---|
387 | % -------------------------------------------------------------------- |
---|
388 | function MenuFile_insert_4_Callback(hObject, eventdata, handles) |
---|
389 | % -------------------------------------------------------------------- |
---|
390 | fileinput=get(handles.MenuFile_insert_4,'Label'); |
---|
391 | display_file_name( handles,fileinput,'append') |
---|
392 | |
---|
393 | % -------------------------------------------------------------------- |
---|
394 | function MenuFile_insert_5_Callback(hObject, eventdata, handles) |
---|
395 | % -------------------------------------------------------------------- |
---|
396 | fileinput=get(handles.MenuFile_insert_5,'Label'); |
---|
397 | display_file_name(handles,fileinput,'append') |
---|
398 | |
---|
399 | %------------------------------------------------------------------------ |
---|
400 | % --- Executes when entered data in editable cell(s) in InputTable. |
---|
401 | function InputTable_CellEditCallback(hObject, eventdata, handles) |
---|
402 | %------------------------------------------------------------------------ |
---|
403 | set(handles.REFRESH,'Visible','on') |
---|
404 | iview=eventdata.Indices(1); |
---|
405 | view_set=get(handles.REFRESH,'UserData'); |
---|
406 | if isempty(find(view_set==iview)) |
---|
407 | set(handles.REFRESH,'UserData',[view_set iview]) |
---|
408 | end |
---|
409 | %% enable other menus and uicontrols |
---|
410 | set(handles.MenuOpen_insert,'Enable','on') |
---|
411 | set(handles.MenuFile_insert_1,'Enable','on') |
---|
412 | set(handles.MenuFile_insert_2,'Enable','on') |
---|
413 | set(handles.MenuFile_insert_3,'Enable','on') |
---|
414 | set(handles.MenuFile_insert_4,'Enable','on') |
---|
415 | set(handles.MenuFile_insert_5,'Enable','on') |
---|
416 | set(handles.RUN, 'Enable','On') |
---|
417 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red |
---|
418 | |
---|
419 | %update the output dir |
---|
420 | % SubDir=sort(InputTable(:,2)); %set of subdirectories sorted in alphabetical order |
---|
421 | % SubDirOut=SubDir{1}; |
---|
422 | % if numel(SubDir)>1 |
---|
423 | % for ilist=2:numel(SubDir) |
---|
424 | % SubDirOut=[SubDirOut '-' SubDir{ilist}]; |
---|
425 | % end |
---|
426 | % end |
---|
427 | % set(handles.OutputSubDir,'String',SubDirOut) |
---|
428 | |
---|
429 | %------------------------------------------------------------------------ |
---|
430 | % --- Executes on button press in REFRESH. |
---|
431 | function REFRESH_Callback(hObject, eventdata, handles) |
---|
432 | %------------------------------------------------------------------------ |
---|
433 | InputTable=get(handles.InputTable,'Data'); |
---|
434 | view_set=get(handles.REFRESH,'UserData'); |
---|
435 | set(handles.REFRESH,'BackgroundColor',[0.7 0.7 0.7])% set REFRESH button to grey color |
---|
436 | drawnow |
---|
437 | for iview=view_set |
---|
438 | RootPath=fullfile(InputTable{iview,1},InputTable{iview,2}); |
---|
439 | if ~exist(RootPath,'dir') |
---|
440 | i1_series=[]; |
---|
441 | RootPath=fileparts(RootPath); %will try the upped forldr |
---|
442 | else |
---|
443 | [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=... |
---|
444 | find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]); |
---|
445 | end |
---|
446 | if isempty(i1_series) |
---|
447 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
448 | {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; |
---|
449 | '*.xml', '.xml files '; ... |
---|
450 | '*.xls', '.xls files '; ... |
---|
451 | '*.png','.png image files'; ... |
---|
452 | '*.tif','.tif image files'; ... |
---|
453 | '*.avi;*.AVI','.avi movie files'; ... |
---|
454 | '*.nc','.netcdf files'; ... |
---|
455 | '*.*', 'All Files (*.*)'}, ... |
---|
456 | ['unvalid entry at line ' num2str(iview) ', pick a file'],RootPath); |
---|
457 | fileinput=[PathName FileName];%complete file name |
---|
458 | if isempty(fileinput),return;end %abandon if the operation has been cancelled: no input from browser |
---|
459 | [path,name,ext]=fileparts(fileinput); |
---|
460 | display_file_name(handles,fileinput,iview) |
---|
461 | else |
---|
462 | update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,iview) |
---|
463 | end |
---|
464 | end |
---|
465 | set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to grey color |
---|
466 | set(handles.REFRESH,'Visible','off') |
---|
467 | set(handles.REFRESH,'UserData',[]) |
---|
468 | |
---|
469 | %------------------------------------------------------------------------ |
---|
470 | % --- Function called when a new file is opened, either by series_OpeningFcn or by the browser |
---|
471 | function display_file_name(handles,fileinput,iview) |
---|
472 | %------------------------------------------------------------------------ |
---|
473 | % |
---|
474 | % INPUT: |
---|
475 | % handles: handles of elements in the GUI |
---|
476 | % fielinput: input file name, including path |
---|
477 | % append =0 (refresh the Input table with the new file), ='append' append a new line in the table |
---|
478 | |
---|
479 | %% get the input root name, indices, file extension and nomenclature NomType |
---|
480 | if ~exist(fileinput,'file') |
---|
481 | msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) |
---|
482 | return |
---|
483 | end |
---|
484 | |
---|
485 | %% enable other menus and uicontrols |
---|
486 | set(handles.MenuOpen_insert,'Enable','on') |
---|
487 | set(handles.MenuFile_insert_1,'Enable','on') |
---|
488 | set(handles.MenuFile_insert_2,'Enable','on') |
---|
489 | set(handles.MenuFile_insert_3,'Enable','on') |
---|
490 | set(handles.MenuFile_insert_4,'Enable','on') |
---|
491 | set(handles.MenuFile_insert_5,'Enable','on') |
---|
492 | set(handles.RUN, 'Enable','On') |
---|
493 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red |
---|
494 | set(handles.InputTable,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow |
---|
495 | drawnow |
---|
496 | |
---|
497 | %% detect root name, nomenclature and indices in the input file name: |
---|
498 | [FilePath,FileName,FileExt]=fileparts(fileinput); |
---|
499 | % detect the file type, get the movie object if relevant, and look for the corresponding file series: |
---|
500 | % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists |
---|
501 | [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]); |
---|
502 | if isempty(RootFile)&&isempty(i1_series) |
---|
503 | errormsg='no input file in the series'; |
---|
504 | return |
---|
505 | end |
---|
506 | |
---|
507 | %% fill the list of file series |
---|
508 | InputTable=get(handles.InputTable,'Data'); |
---|
509 | if strcmp(iview,'append') % display the input data as a new line in the table |
---|
510 | iview=size(InputTable,1); |
---|
511 | InputTable(iview+1,:)={'','','','',''}; |
---|
512 | InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; |
---|
513 | elseif iview==0 % or re-initialise the list of input file series |
---|
514 | iview=1; |
---|
515 | InputTable=[{'','','','',''};{'','','','',''}]; |
---|
516 | InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; |
---|
517 | set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) |
---|
518 | set(handles.MinIndex,'Data',[{[]},{[]}]) |
---|
519 | set(handles.MaxIndex,'Data',[{[]},{[]}]) |
---|
520 | set(handles.ListView,'Value',1) |
---|
521 | set(handles.ListView,'String',{'1'}) |
---|
522 | end |
---|
523 | nbview=size(InputTable,1); |
---|
524 | set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1))) |
---|
525 | set(handles.ListView,'Value',iview) |
---|
526 | set(handles.InputTable,'Data',InputTable) |
---|
527 | |
---|
528 | %% determine the selected reference field indices for pair display |
---|
529 | ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV |
---|
530 | if ~isempty(i1) |
---|
531 | ref_i=i1; |
---|
532 | if ~isempty(i2) |
---|
533 | ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file |
---|
534 | end |
---|
535 | end |
---|
536 | set(handles.num_ref_i,'String',num2str(ref_i)); |
---|
537 | ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV |
---|
538 | if ~isempty(j1) |
---|
539 | ref_j=j1; |
---|
540 | if ~isempty(j2) |
---|
541 | ref_j=floor((j1+j2)/2); |
---|
542 | end |
---|
543 | end |
---|
544 | set(handles.num_ref_j,'String',num2str(ref_j)); |
---|
545 | |
---|
546 | %% update the list of recent files in the menubar and save it for future opening |
---|
547 | MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};... |
---|
548 | {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; |
---|
549 | str_find=strcmp(fileinput,MenuFile); |
---|
550 | if isempty(find(str_find,1)) |
---|
551 | MenuFile=[{fileinput};MenuFile];%insert the current file if not already in the list |
---|
552 | end |
---|
553 | for ifile=1:min(length(MenuFile),5) |
---|
554 | eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) |
---|
555 | eval(['set(handles.MenuFile_insert_' num2str(ifile) ',''Label'',MenuFile{ifile});']) |
---|
556 | end |
---|
557 | dir_perso=prefdir; |
---|
558 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
559 | if exist(profil_perso,'file') |
---|
560 | save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat |
---|
561 | else |
---|
562 | save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat |
---|
563 | end |
---|
564 | |
---|
565 | set(handles.InputTable,'BackgroundColor',[1 1 1]) |
---|
566 | |
---|
567 | %% initiate input file series and refresh the current field view: |
---|
568 | update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,iview); |
---|
569 | |
---|
570 | %------------------------------------------------------------------------ |
---|
571 | % --- Update information about a new field series (indices to scan, timing, |
---|
572 | % calibration from an xml file |
---|
573 | function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,iview) |
---|
574 | %------------------------------------------------------------------------ |
---|
575 | %% update the output dir |
---|
576 | InputTable=get(handles.InputTable,'Data'); |
---|
577 | SubDir=sort(InputTable(1:end-1,2)); %set of subdirectories sorted in alphabetical order |
---|
578 | SubDirOut=SubDir{1}; |
---|
579 | if numel(SubDir)>1 |
---|
580 | for ilist=2:numel(SubDir) |
---|
581 | SubDirOut=[SubDirOut '-' SubDir{ilist}]; |
---|
582 | end |
---|
583 | end |
---|
584 | set(handles.OutputSubDir,'String',SubDirOut) |
---|
585 | |
---|
586 | %% display the min and max indices for the file series |
---|
587 | pair_max=squeeze(max(i1_series,[],1)); %max on pair index |
---|
588 | j_max=max(pair_max,[],1); |
---|
589 | %i_sum=sum(sum(i1_series,2),1);%sum of i1_series on the last index |
---|
590 | MaxIndex_i=max(find(j_max))-1;% max ref index i |
---|
591 | MinIndex_i=min(find(j_max))-1;% min ref index i |
---|
592 | i_max=max(pair_max,[],2); |
---|
593 | MaxIndex_j=max(find(i_max))-1;% max ref index i |
---|
594 | MinIndex_j=min(find(i_max))-1;% min ref index i |
---|
595 | MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex |
---|
596 | MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex |
---|
597 | MinIndex{iview,1}=MinIndex_i; |
---|
598 | MinIndex{iview,2}=MinIndex_j; |
---|
599 | MaxIndex{iview,1}=MaxIndex_i; |
---|
600 | MaxIndex{iview,2}=MaxIndex_j; |
---|
601 | |
---|
602 | set(handles.MinIndex,'Data',MinIndex)%display the min indices in the table MinIndex |
---|
603 | set(handles.MaxIndex,'Data',MaxIndex)%display the max indices in the table MaxIndex |
---|
604 | |
---|
605 | %% adjust the first and last indices if requested by the bounds |
---|
606 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
607 | ref_i=str2num(get(handles.num_ref_i,'String')); |
---|
608 | ref_j=str2num(get(handles.num_ref_j,'String')); |
---|
609 | if isempty(first_i) |
---|
610 | first_i=ref_i; |
---|
611 | elseif first_i < MinIndex_i |
---|
612 | first_i=MinIndex_i; |
---|
613 | end |
---|
614 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
615 | if isempty(first_j) |
---|
616 | first_j=ref_j; |
---|
617 | elseif first_j<MinIndex_j |
---|
618 | first_j=MinIndex_j; |
---|
619 | end |
---|
620 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
621 | if isempty(last_i) |
---|
622 | last_i=ref_i; |
---|
623 | elseif last_i > MaxIndex_i |
---|
624 | last_i=MaxIndex_i; |
---|
625 | end |
---|
626 | last_j=str2num(get(handles.num_first_j,'String')); |
---|
627 | if isempty(last_j) |
---|
628 | last_j=ref_j; |
---|
629 | elseif last_j>MaxIndex_j |
---|
630 | last_j=MaxIndex_j; |
---|
631 | end |
---|
632 | set(handles.num_first_i,'String',num2str(first_i)); |
---|
633 | set(handles.num_first_j,'String',num2str(first_j)); |
---|
634 | set(handles.num_last_i,'String',num2str(last_i)); |
---|
635 | set(handles.num_last_j,'String',num2str(last_j)); |
---|
636 | |
---|
637 | %% read timing and total frame number from the current file (movie files) !! may be overrid by xml file |
---|
638 | InputTable=get(handles.InputTable,'Data'); |
---|
639 | FileBase=fullfile(InputTable{iview,1},InputTable{iview,3}); |
---|
640 | time=[];%default |
---|
641 | % case of movies |
---|
642 | if strcmp(InputTable{iview,4},'*') |
---|
643 | if ~isempty(VideoObject) |
---|
644 | imainfo=get(VideoObject); |
---|
645 | time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)'; |
---|
646 | set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec |
---|
647 | ColorType='truecolor'; |
---|
648 | elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image |
---|
649 | if ~isempty(InputTable{iview,2}) |
---|
650 | imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); |
---|
651 | else |
---|
652 | imainfo=imfinfo([FileBase InputTable{iview,5}]); |
---|
653 | end |
---|
654 | ColorType=imainfo.ColorType;%='truecolor' for color images |
---|
655 | if length(imainfo) >1 %case of image with multiple frames |
---|
656 | nbfield=length(imainfo); |
---|
657 | nbfield_j=1; |
---|
658 | end |
---|
659 | end |
---|
660 | end |
---|
661 | |
---|
662 | %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
663 | XmlData=[]; |
---|
664 | NbSlice_calib={}; |
---|
665 | XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5}); |
---|
666 | if ~isempty(XmlFileName) |
---|
667 | [XmlData,warntext]=imadoc2struct(XmlFileName); |
---|
668 | if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) |
---|
669 | [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); |
---|
670 | end |
---|
671 | if isfield(XmlData,'Time') |
---|
672 | time=XmlData.Time; |
---|
673 | end |
---|
674 | if isfield(XmlData,'Camera') |
---|
675 | if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) |
---|
676 | NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform |
---|
677 | if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) |
---|
678 | msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); |
---|
679 | end |
---|
680 | end |
---|
681 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) |
---|
682 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
683 | end |
---|
684 | end |
---|
685 | if ~isempty(warntext) |
---|
686 | msgbox_uvmat('WARNING',warntext) |
---|
687 | end |
---|
688 | end |
---|
689 | |
---|
690 | %% update time table |
---|
691 | if ~isempty(time) |
---|
692 | TimeTable=get(handles.TimeTable,'Data'); |
---|
693 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
694 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
695 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
696 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
697 | MinIndexTable=get(handles.MinIndex,'Data'); |
---|
698 | MinIndex_i=MinIndexTable{iview,1}; |
---|
699 | MinIndex_j=MinIndexTable{iview,2}; |
---|
700 | MaxIndexTable=get(handles.MaxIndex,'Data'); |
---|
701 | MaxIndex_i=MaxIndexTable{iview,1}; |
---|
702 | MaxIndex_j=MaxIndexTable{iview,2}; |
---|
703 | if isempty(MinIndex_j) |
---|
704 | if MinIndex_i>0 |
---|
705 | TimeTable{iview,1}=time(MinIndex_i); |
---|
706 | end |
---|
707 | TimeTable{iview,2}=time(first_i); |
---|
708 | TimeTable{iview,3}=time(last_i); |
---|
709 | TimeTable{iview,4}=time(MaxIndex_i); |
---|
710 | elseif ~isempty(time) |
---|
711 | if MinIndex_i>0 |
---|
712 | TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); |
---|
713 | end |
---|
714 | TimeTable{iview,2}=time(first_i,first_j); |
---|
715 | TimeTable{iview,3}=time(last_i,last_j); |
---|
716 | TimeTable{iview,4}=time(MaxIndex_i,MaxIndex_j); |
---|
717 | end |
---|
718 | set(handles.TimeTable,'Data',TimeTable) |
---|
719 | end |
---|
720 | |
---|
721 | %% number of slices |
---|
722 | NbSlice=1;%default |
---|
723 | if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') |
---|
724 | siz=size(XmlData.GeometryCalib.SliceCoord); |
---|
725 | if siz(1)>1 |
---|
726 | NbSlice=siz(1); |
---|
727 | end |
---|
728 | end |
---|
729 | set(handles.num_NbSlice,'String',num2str(NbSlice)) |
---|
730 | |
---|
731 | %% update pair menus |
---|
732 | set(handles.Pairs,'Visible','on') |
---|
733 | set(handles.PairString,'Visible','on') |
---|
734 | ListView=get(handles.ListView,'String'); |
---|
735 | ListView{iview}=num2str(iview); |
---|
736 | set(handles.ListView,'String',ListView); |
---|
737 | set(handles.ListView,'Value',iview) |
---|
738 | update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) |
---|
739 | |
---|
740 | %% update the series info in 'UserData' |
---|
741 | SeriesData=get(handles.series,'UserData'); |
---|
742 | SeriesData.i1_series{iview}=i1_series; |
---|
743 | SeriesData.i2_series{iview}=i2_series; |
---|
744 | SeriesData.j1_series{iview}=j1_series; |
---|
745 | SeriesData.j2_series{iview}=j2_series; |
---|
746 | SeriesData.FileType{iview}=FileType; |
---|
747 | SeriesData.Time{iview}=time; |
---|
748 | set(handles.series,'UserData',SeriesData) |
---|
749 | |
---|
750 | %% enable j index visibilitycellfun(@isempty,regexp(PairString,'^j')) |
---|
751 | state='off'; |
---|
752 | check_jindex=~cellfun(@isempty,SeriesData.j1_series); %look for non empty j indices |
---|
753 | if isempty(find(check_jindex)) |
---|
754 | enable_j(handles,'off') % no j index needed |
---|
755 | else |
---|
756 | PairString=get(handles.PairString,'Data'); |
---|
757 | if isempty(find(cellfun(@isempty,regexp(PairString,'^j'))))% if all pair string begins by j (burst) |
---|
758 | enable_j(handles,'off') % no j index needed |
---|
759 | else |
---|
760 | enable_j(handles,'on') |
---|
761 | end |
---|
762 | end |
---|
763 | |
---|
764 | %% display the set of existing files as an image |
---|
765 | set(handles.FileStatus,'Units','pixels') |
---|
766 | Position=get(handles.FileStatus,'Position'); |
---|
767 | set(handles.FileStatus,'Units','normalized') |
---|
768 | xI=0.5:Position(3)-0.5; |
---|
769 | nbview=numel(SeriesData.i1_series); |
---|
770 | pair_max=cell(1,nbview); |
---|
771 | for iview=1:nbview |
---|
772 | pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index |
---|
773 | if strcmp(get(handles.num_first_j,'Visible'),'off') |
---|
774 | pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index |
---|
775 | end |
---|
776 | index_min(iview)=find(pair_max{iview}>0, 1 ); |
---|
777 | index_max(iview)=find(pair_max{iview}>0, 1, 'last' ); |
---|
778 | end |
---|
779 | index_min=min(index_min); |
---|
780 | index_max=max(index_max); |
---|
781 | range_index=index_max-index_min+1; |
---|
782 | scale_y=Position(4)/nbview; |
---|
783 | scale_x=Position(3)/range_index; |
---|
784 | x=(0.5:range_index-0.5)*Position(3)/range_index; |
---|
785 | % y=(0.5:nbview-0.5)*Position(4)/nbview; |
---|
786 | range_y=max(1,floor(Position(4)/nbview)); |
---|
787 | CData=zeros(nbview*range_y,Position(3)); |
---|
788 | for iview=1:nbview |
---|
789 | ind_y=1+(iview-1)*range_y:iview*range_y; |
---|
790 | LineData=zeros(1,range_index); |
---|
791 | x_index=find(pair_max{iview}>0)-index_min+1; |
---|
792 | LineData(x_index)=1; |
---|
793 | LineData=interp1(x,LineData,xI,'nearest'); |
---|
794 | CData(ind_y,:)=ones(size(ind_y'))*LineData; |
---|
795 | end |
---|
796 | CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); |
---|
797 | set(handles.FileStatus,'CData',CData); |
---|
798 | |
---|
799 | |
---|
800 | %% enable field and veltype menus, in accordance with the current action |
---|
801 | ActionName_Callback([],[], handles) |
---|
802 | |
---|
803 | %% check for pair display |
---|
804 | check_pairs=0; |
---|
805 | for iview=1:numel(SeriesData.i2_series) |
---|
806 | if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview}) |
---|
807 | check_pairs=1; |
---|
808 | end |
---|
809 | end |
---|
810 | if check_pairs |
---|
811 | set(handles.Pairs,'Visible','on') |
---|
812 | set(handles.PairString,'Visible','on') |
---|
813 | else |
---|
814 | set(handles.Pairs,'Visible','off') |
---|
815 | set(handles.PairString,'Visible','off') |
---|
816 | end |
---|
817 | |
---|
818 | %% set length of waitbar |
---|
819 | displ_time(handles) |
---|
820 | |
---|
821 | |
---|
822 | %% set default options in menu 'Fields' |
---|
823 | switch FileType |
---|
824 | case {'civx','civdata'} |
---|
825 | [FieldList,ColorList]=calc_field; |
---|
826 | set(handles.FieldName,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data |
---|
827 | set(handles.FieldName,'Value',2) % set menu to 'velocity |
---|
828 | set(handles.Coord_x,'Value',1); |
---|
829 | set(handles.Coord_x,'String',{'X'}); |
---|
830 | set(handles.Coord_y,'Value',1); |
---|
831 | set(handles.Coord_y,'String',{'Y'}); |
---|
832 | case 'netcdf' |
---|
833 | set(handles_Fields,'Value',1) |
---|
834 | set(handles_Fields,'String',{'get_field...'}) |
---|
835 | hget_field=get_field(FileName); |
---|
836 | hhget_field=guidata(hget_field); |
---|
837 | get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); |
---|
838 | otherwise |
---|
839 | set(handles_Fields,'Value',1) % set menu to 'image' |
---|
840 | set(handles_Fields,'String',{'image'}) |
---|
841 | set(handles.Coord_x,'Value',1); |
---|
842 | set(handles.Coord_x,'String',{'AX'}); |
---|
843 | set(handles.Coord_y,'Value',1); |
---|
844 | set(handles.Coord_y,'String',{'AY'}); |
---|
845 | end |
---|
846 | % %% set default options in menu 'Fields'%% TODO: check VelType |
---|
847 | % if ~testima |
---|
848 | % testcivx=0; |
---|
849 | % if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) |
---|
850 | % set(handles_Fields,'Value',1) |
---|
851 | % set(handles_Fields,'String',{'get_field...'}) |
---|
852 | % UvData=rmfield(UvData,'FieldsString'); |
---|
853 | % else |
---|
854 | % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ'); |
---|
855 | % if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx |
---|
856 | % FieldList=calc_field; |
---|
857 | % set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data |
---|
858 | % set(handles_Fields,'Value',2) % set menu to 'velocity' |
---|
859 | % col_vec=FieldList; |
---|
860 | % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) |
---|
861 | % testcivx=1; |
---|
862 | % end |
---|
863 | % if ~testcivx |
---|
864 | % set(handles_Fields,'Value',1) % set menu to 'get_field... |
---|
865 | % set(handles_Fields,'String',{'get_field...'}) |
---|
866 | % col_vec={'get_field...'}; |
---|
867 | % end |
---|
868 | % set(handles.ColorScalar,'String',col_vec) |
---|
869 | % end |
---|
870 | % end |
---|
871 | % set(handles.uvmat,'UserData',UvData) |
---|
872 | % |
---|
873 | % %% set index navigation options and refresh plots |
---|
874 | % scan_option='i';%default |
---|
875 | % state_j='off'; %default |
---|
876 | % if index==2 |
---|
877 | % if get(handles.scan_j,'Value') |
---|
878 | % scan_option='j'; %keep the scan option for the second fiel series |
---|
879 | % end |
---|
880 | % if strcmp(get(handles.j1,'Visible'),'on') |
---|
881 | % state_j='on'; |
---|
882 | % end |
---|
883 | % end |
---|
884 | % if ~isempty(j1_series) |
---|
885 | % state_j='on'; |
---|
886 | % if isequal(nbfield,1) &&index==1 |
---|
887 | % scan_option='j'; %scan j index by default if nbfield=1 |
---|
888 | % end |
---|
889 | % end |
---|
890 | % if isequal(scan_option,'i') |
---|
891 | % set(handles.scan_i,'Value',1) |
---|
892 | % scan_i_Callback([],[], handles); |
---|
893 | % else |
---|
894 | % set(handles.scan_j,'Value',1) |
---|
895 | % scan_j_Callback([],[], handles); |
---|
896 | % end |
---|
897 | % set(handles.scan_j,'Visible',state_j) |
---|
898 | % set(handles.j1,'Visible',state_j) |
---|
899 | % set(handles.j2,'Visible',state_j) |
---|
900 | % set(handles.last_j,'Visible',state_j); |
---|
901 | % set(handles.frame_j,'Visible',state_j); |
---|
902 | % set(handles.j_text,'Visible',state_j); |
---|
903 | % if ~isempty(i2_series)||~isempty(j2_series) |
---|
904 | % set(handles.CheckFixPair,'Visible','on') |
---|
905 | % elseif index==1 |
---|
906 | % set(handles.CheckFixPair,'Visible','off') |
---|
907 | % end |
---|
908 | % |
---|
909 | % |
---|
910 | % mode_Callback(hObject, eventdata, handles) |
---|
911 | % |
---|
912 | % set(handles.REFRESH,'BackgroundColor',[0.7 0.7 0.7]) |
---|
913 | % InputTable=get(handles.InputTable,'Data'); |
---|
914 | % check_lines=get(handles.REFRESH,'UserData'); |
---|
915 | % |
---|
916 | % %% check the indices and FileTypes for each series (limited to the new ones to save time) |
---|
917 | % for ind_list=1:length(check_lines) |
---|
918 | % if check_lines(ind_list) |
---|
919 | % InputLine=InputTable(ind_list,:); |
---|
920 | % detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) |
---|
921 | % detect_idem=detect_idem(detect_idem>0); |
---|
922 | % if ~isempty (detect_idem) |
---|
923 | % InputLine(detect_idem)=InputTable(ind_list-1,detect_idem); |
---|
924 | % set(handles.InputTable,'Data',InputTable) |
---|
925 | % end |
---|
926 | % fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2); |
---|
927 | % %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}) |
---|
928 | % %update file series defined by the selected line |
---|
929 | % [InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list); |
---|
930 | % if ~isempty(errormsg) |
---|
931 | % msgbox_uvmat('ERROR',errormsg) |
---|
932 | % return |
---|
933 | % end |
---|
934 | % end |
---|
935 | % end |
---|
936 | % set(handles.InputTable,'Data',InputTable) |
---|
937 | % SeriesData=get(handles.series,'UserData'); |
---|
938 | % |
---|
939 | % state_j='off'; |
---|
940 | % state_Pairs='off'; |
---|
941 | % state_InputFields='off'; |
---|
942 | % val=get(handles.ListView,'Value'); |
---|
943 | % ListViewString={''}; |
---|
944 | % if ~isempty(SeriesData) |
---|
945 | % % ListViewString={}; |
---|
946 | % for iview=1:size(InputTable,1) |
---|
947 | % if ~isempty(SeriesData.j1_series{iview}) |
---|
948 | % state_j='on'; |
---|
949 | % end |
---|
950 | % if ~isempty(SeriesData.i2_series{iview})||~isempty(SeriesData.j2_series{iview}) |
---|
951 | % state_Pairs='on'; |
---|
952 | % ListViewString{iview}=num2str(iview); |
---|
953 | % if check_lines(iview) |
---|
954 | % val=iview;%select the last pair if it is a new entry |
---|
955 | % end |
---|
956 | % end |
---|
957 | % if strcmp(SeriesData.FileType{iview},'civx')||strcmp(SeriesData.FileType{iview},'civdata') |
---|
958 | % state_InputFields='on'; |
---|
959 | % end |
---|
960 | % end |
---|
961 | % end |
---|
962 | % set(handles.ListView,'Value',val) |
---|
963 | % set(handles.ListView,'String',ListViewString) |
---|
964 | % if strcmp(state_Pairs,'on') |
---|
965 | % ListView_Callback(hObject,eventdata,handles) |
---|
966 | % end |
---|
967 | % set(handles.PairString,'Visible',state_Pairs) |
---|
968 | % enable_j(handles,state_j) |
---|
969 | |
---|
970 | %------------------------------------------------------------------------ |
---|
971 | function num_first_i_Callback(hObject, eventdata, handles) |
---|
972 | %------------------------------------------------------------------------ |
---|
973 | num_last_i_Callback(hObject, eventdata, handles) |
---|
974 | |
---|
975 | %------------------------------------------------------------------------ |
---|
976 | function num_last_i_Callback(hObject, eventdata, handles) |
---|
977 | %------------------------------------------------------------------------ |
---|
978 | SeriesData=get(handles.series,'UserData'); |
---|
979 | if ~isfield(SeriesData,'Time') |
---|
980 | SeriesData.Time{1}=[]; |
---|
981 | end |
---|
982 | displ_time(handles); |
---|
983 | |
---|
984 | %------------------------------------------------------------------------ |
---|
985 | function num_first_j_Callback(hObject, eventdata, handles) |
---|
986 | %------------------------------------------------------------------------ |
---|
987 | num_last_j_Callback(hObject, eventdata, handles) |
---|
988 | |
---|
989 | %------------------------------------------------------------------------ |
---|
990 | function num_last_j_Callback(hObject, eventdata, handles) |
---|
991 | %------------------------------------------------------------------------ |
---|
992 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
993 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
994 | ref_j=ceil((first_j+last_j)/2); |
---|
995 | set(handles.num_ref_j,'String', num2str(ref_j)) |
---|
996 | num_ref_j_Callback(hObject, eventdata, handles) |
---|
997 | SeriesData=get(handles.series,'UserData'); |
---|
998 | if ~isfield(SeriesData,'Time') |
---|
999 | SeriesData.Time{1}=[]; |
---|
1000 | end |
---|
1001 | displ_time(handles); |
---|
1002 | |
---|
1003 | |
---|
1004 | %------------------------------------------------------------------------ |
---|
1005 | % ---- find the times corresponding to the first and last indices of a series |
---|
1006 | function displ_time(handles) |
---|
1007 | %------------------------------------------------------------------------ |
---|
1008 | SeriesData=get(handles.series,'UserData');% |
---|
1009 | ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))]; |
---|
1010 | ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))]; |
---|
1011 | TimeTable=get(handles.TimeTable,'Data'); |
---|
1012 | Pairs=get(handles.PairString,'Data'); |
---|
1013 | for iview=1:size(TimeTable,1) |
---|
1014 | if size(SeriesData.Time,1)<iview |
---|
1015 | break |
---|
1016 | end |
---|
1017 | i1=ref_i; |
---|
1018 | j1=ref_j; |
---|
1019 | i2=ref_i; |
---|
1020 | j2=ref_j; |
---|
1021 | % case of pairs |
---|
1022 | if ~isempty(Pairs{iview,1}) |
---|
1023 | r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
1024 | if isempty(r) |
---|
1025 | r=regexp(Pairs{iview,1},'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); |
---|
1026 | end |
---|
1027 | switch r.mode |
---|
1028 | case 'Di=' % case 'series(Di)') |
---|
1029 | i1=ref_i-str2num(r.num1); |
---|
1030 | i2=ref_i+str2num(r.num2); |
---|
1031 | case 'Dj=' % case 'series(Dj)' |
---|
1032 | j1=ref_j-str2num(r.num1); |
---|
1033 | j2=ref_j+str2num(r.num2); |
---|
1034 | case '-' % case 'bursts' |
---|
1035 | j1=str2num(r.num1)*ones(size(ref_i)); |
---|
1036 | j2=str2num(r.num2)*ones(size(ref_i)); |
---|
1037 | end |
---|
1038 | end |
---|
1039 | TimeTable{iview,2}=[]; |
---|
1040 | TimeTable{iview,3}=[]; |
---|
1041 | if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2) |
---|
1042 | if isempty(ref_j) |
---|
1043 | time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; |
---|
1044 | time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; |
---|
1045 | else |
---|
1046 | time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; |
---|
1047 | time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; |
---|
1048 | end |
---|
1049 | TimeTable{iview,2}=time_first; %TODO: take into account pairs |
---|
1050 | TimeTable{iview,3}=time_last; %TODO: take into account pairs |
---|
1051 | end |
---|
1052 | end |
---|
1053 | set(handles.TimeTable,'Data',TimeTable) |
---|
1054 | |
---|
1055 | %% set the waitbar position with respect to the min and max in the series |
---|
1056 | % for iview=1:numel(SeriesData.i1_series) |
---|
1057 | % [tild,index_min(iview)]=min(SeriesData.i1_series{iview}(SeriesData.i1_series{iview}>0)); |
---|
1058 | % [tild,index_max(iview)]=max(SeriesData.i1_series{iview}(SeriesData.i1_series{iview}>0)); |
---|
1059 | % end |
---|
1060 | for iview=1:numel(SeriesData.i1_series) |
---|
1061 | index_min(iview)=min(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); |
---|
1062 | index_max(iview)=max(find(SeriesData.i1_series{iview}(1,2:end,2:end)>0)); |
---|
1063 | end |
---|
1064 | [index_min,iview_min]=min(index_min); |
---|
1065 | [index_max,iview_max]=min(index_max); |
---|
1066 | index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},2)-1)+ref_j(1); |
---|
1067 | index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},2)-1)+ref_j(2); |
---|
1068 | range=index_max-index_min+1; |
---|
1069 | coeff_min=(index_first-index_min)/range; |
---|
1070 | coeff_max=(index_last-index_min+1)/range; |
---|
1071 | Position=get(handles.Waitbar,'Position'); |
---|
1072 | Position_status=get(handles.FileStatus,'Position'); |
---|
1073 | Position(1)=coeff_min*Position_status(3)+Position_status(1); |
---|
1074 | Position(3)=Position_status(3)*(coeff_max-coeff_min); |
---|
1075 | set(handles.Waitbar,'Position',Position) |
---|
1076 | update_waitbar(handles.Waitbar,0) |
---|
1077 | |
---|
1078 | %------------------------------------------------------------------------ |
---|
1079 | % --- Executes when selected cell(s) is changed in PairString. |
---|
1080 | function PairString_CellSelectionCallback(hObject, eventdata, handles) |
---|
1081 | %------------------------------------------------------------------------ |
---|
1082 | set(handles.ListView,'Value',eventdata.Indices(1))% detect the selected raw index |
---|
1083 | ListView_Callback ([],[],handles) % update the list of available pairs |
---|
1084 | |
---|
1085 | %------------------------------------------------------------------------ |
---|
1086 | %------------------------------------------------------------------------ |
---|
1087 | % III - FUNCTIONS ASSOCIATED TO THE FRAME SET PAIRS |
---|
1088 | %------------------------------------------------------------------------ |
---|
1089 | %------------------------------------------------------------------------ |
---|
1090 | % --- Executes on selection change in ListView. |
---|
1091 | function ListView_Callback(hObject, eventdata, handles) |
---|
1092 | %------------------------------------------------------------------------ |
---|
1093 | SeriesData=get(handles.series,'UserData'); |
---|
1094 | i2_series=[]; |
---|
1095 | j2_series=[]; |
---|
1096 | iview=get(handles.ListView,'Value'); |
---|
1097 | if ~isempty(SeriesData.i2_series{iview}) |
---|
1098 | i2_series=SeriesData.i2_series{iview}; |
---|
1099 | end |
---|
1100 | if ~isempty(SeriesData.j2_series{iview}) |
---|
1101 | j2_series=SeriesData.j2_series{iview}; |
---|
1102 | end |
---|
1103 | update_mode(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... |
---|
1104 | SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview}) |
---|
1105 | |
---|
1106 | %------------------------------------------------------------------------ |
---|
1107 | % --- Executes on button press in mode. |
---|
1108 | function mode_Callback(hObject, eventdata, handles) |
---|
1109 | %------------------------------------------------------------------------ |
---|
1110 | SeriesData=get(handles.series,'UserData'); |
---|
1111 | iview=get(handles.ListView,'Value'); |
---|
1112 | mode_list=get(handles.mode,'String'); |
---|
1113 | mode=mode_list{get(handles.mode,'Value')}; |
---|
1114 | if isequal(mode,'bursts') |
---|
1115 | enable_i(handles,'On') |
---|
1116 | enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) |
---|
1117 | else |
---|
1118 | enable_i(handles,'On') |
---|
1119 | enable_j(handles,'Off') |
---|
1120 | end |
---|
1121 | fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... |
---|
1122 | SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview}) |
---|
1123 | ListPairs_Callback([],[],handles) |
---|
1124 | |
---|
1125 | %------------------------------------------------------------- |
---|
1126 | % --- Executes on selection in ListPairs. |
---|
1127 | function ListPairs_Callback(hObject,eventdata,handles) |
---|
1128 | %------------------------------------------------------------ |
---|
1129 | list_pair=get(handles.ListPairs,'String');%get the menu of image pairs |
---|
1130 | if isempty(list_pair) |
---|
1131 | string=''; |
---|
1132 | else |
---|
1133 | string=list_pair{get(handles.ListPairs,'Value')}; |
---|
1134 | string=regexprep(string,',.*','');%removes time indication (after ',') |
---|
1135 | end |
---|
1136 | PairString=get(handles.PairString,'Data'); |
---|
1137 | iview=get(handles.ListView,'Value'); |
---|
1138 | PairString{iview,1}=string; |
---|
1139 | % report the selected pair string to the table PairString |
---|
1140 | set(handles.PairString,'Data',PairString) |
---|
1141 | |
---|
1142 | %------------------------------------------------------------------------ |
---|
1143 | function num_ref_i_Callback(hObject, eventdata, handles) |
---|
1144 | %------------------------------------------------------------------------ |
---|
1145 | mode_list=get(handles.mode,'String'); |
---|
1146 | mode=mode_list{get(handles.mode,'Value')}; |
---|
1147 | SeriesData=get(handles.series,'UserData'); |
---|
1148 | iview=get(handles.ListView,'Value'); |
---|
1149 | fill_ListPair(handles,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... |
---|
1150 | SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview});% update the menu of pairs depending on the available netcdf files |
---|
1151 | ListPairs_Callback([],[],handles) |
---|
1152 | |
---|
1153 | %------------------------------------------------------------------------ |
---|
1154 | function num_ref_j_Callback(hObject, eventdata, handles) |
---|
1155 | %------------------------------------------------------------------------ |
---|
1156 | num_ref_i_Callback(hObject, eventdata, handles) |
---|
1157 | |
---|
1158 | %------------------------------------------------------------------------ |
---|
1159 | function update_mode(handles,i1_series,i2_series,j1_series,j2_series,time) |
---|
1160 | %------------------------------------------------------------------------ |
---|
1161 | % check_burst=0; |
---|
1162 | if isempty(j2_series)% no j pair |
---|
1163 | if isempty(i2_series) |
---|
1164 | set(handles.mode,'Value',1) |
---|
1165 | set(handles.mode,'String',{''})% no pair menu to display |
---|
1166 | else |
---|
1167 | set(handles.mode,'Value',1) |
---|
1168 | set(handles.mode,'String',{'series(Di)'}) % pair menu with only option Di |
---|
1169 | end |
---|
1170 | else %existence of j pairs |
---|
1171 | pair_max=squeeze(max(i1_series,[],1)); %max on pair index |
---|
1172 | j_max=max(pair_max,[],1); |
---|
1173 | MaxIndex_i=max(find(j_max))-1;% max ref index i |
---|
1174 | MinIndex_i=min(find(j_max))-1;% min ref index i |
---|
1175 | i_max=max(pair_max,[],2); |
---|
1176 | MaxIndex_j=max(find(i_max))-1;% max ref index i |
---|
1177 | MinIndex_j=min(find(i_max))-1;% min ref index i |
---|
1178 | if MaxIndex_j==MinIndex_j |
---|
1179 | set(handles.mode,'Value',1); |
---|
1180 | set(handles.mode,'String',{'bursts'}) |
---|
1181 | % check_burst=1; |
---|
1182 | elseif MaxIndex_i==MinIndex_i |
---|
1183 | set(handles.mode,'Value',1); |
---|
1184 | set(handles.mode,'String',{'series(Dj)'}) |
---|
1185 | else |
---|
1186 | set(handles.mode,'String',{'bursts';'series(Dj)'}) |
---|
1187 | if (MaxIndex_j-MinIndex_j)>10 |
---|
1188 | set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values |
---|
1189 | else |
---|
1190 | set(handles.mode,'Value',1); |
---|
1191 | % check_burst=1; |
---|
1192 | end |
---|
1193 | end |
---|
1194 | end |
---|
1195 | % if check_burst |
---|
1196 | % enable_i(handles,'On') |
---|
1197 | % enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) |
---|
1198 | % else |
---|
1199 | % enable_i(handles,'On') |
---|
1200 | % if isempty(j1_series) |
---|
1201 | % enable_j(handles,'Off') |
---|
1202 | % else |
---|
1203 | % enable_j(handles,'On') |
---|
1204 | % end |
---|
1205 | % end |
---|
1206 | fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) |
---|
1207 | ListPairs_Callback([],[],handles) |
---|
1208 | |
---|
1209 | %-------------------------------------------------------------- |
---|
1210 | % determine the menu for civ1 pairstring depending on existing netcdf files |
---|
1211 | % with the reference indices num_ref_i and num_ref_j |
---|
1212 | %---------------------------------------------------------------- |
---|
1213 | function fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) |
---|
1214 | |
---|
1215 | mode_list=get(handles.mode,'String'); |
---|
1216 | mode=mode_list{get(handles.mode,'Value')}; |
---|
1217 | ref_i=str2num(get(handles.num_ref_i,'String')); |
---|
1218 | if isempty(ref_i) |
---|
1219 | ref_i=1; |
---|
1220 | end |
---|
1221 | if strcmp(get(handles.num_ref_j,'Visible'),'on') |
---|
1222 | ref_j=str2num(get(handles.num_ref_j,'String')); |
---|
1223 | if isempty(ref_j) |
---|
1224 | ref_j=1; |
---|
1225 | end |
---|
1226 | else |
---|
1227 | ref_j=1; |
---|
1228 | end |
---|
1229 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
1230 | if length(TimeUnit)>=1 |
---|
1231 | dtunit=['m' TimeUnit]; |
---|
1232 | else |
---|
1233 | dtunit='e-03'; |
---|
1234 | end |
---|
1235 | |
---|
1236 | displ_pair={}; |
---|
1237 | if strcmp(mode,'series(Di)') |
---|
1238 | if isempty(i2_series) |
---|
1239 | msgbox_uvmat('ERROR','no i1-i2 pair available') |
---|
1240 | return |
---|
1241 | end |
---|
1242 | diff_i=i2_series-i1_series; |
---|
1243 | min_diff=min(diff_i(diff_i>0)); |
---|
1244 | max_diff=max(diff_i(diff_i>0)); |
---|
1245 | for ipair=min_diff:max_diff |
---|
1246 | if numel(diff_i(diff_i==ipair))>0 |
---|
1247 | pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; |
---|
1248 | if ~isempty(time) |
---|
1249 | if ref_i<=floor(ipair/2) |
---|
1250 | ref_i=floor(ipair/2)+1;% shift ref_i to get the first pair |
---|
1251 | end |
---|
1252 | Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j); |
---|
1253 | pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit]; |
---|
1254 | end |
---|
1255 | displ_pair=[displ_pair;{pair_string}]; |
---|
1256 | end |
---|
1257 | end |
---|
1258 | if ~isempty(displ_pair) |
---|
1259 | displ_pair=[displ_pair;{'Di=*|*'}]; |
---|
1260 | end |
---|
1261 | elseif strcmp(mode,'series(Dj)') |
---|
1262 | if isempty(j2_series) |
---|
1263 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
1264 | return |
---|
1265 | end |
---|
1266 | diff_j=j2_series-j1_series; |
---|
1267 | min_diff=min(diff_j(diff_j>0)); |
---|
1268 | max_diff=max(diff_j(diff_j>0)); |
---|
1269 | for ipair=min_diff:max_diff |
---|
1270 | if numel(diff_j(diff_j==ipair))>0 |
---|
1271 | pair_string=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; |
---|
1272 | if ~isempty(time) |
---|
1273 | if ref_j<=floor(ipair/2) |
---|
1274 | ref_j=floor(ipair/2)+1;% shift ref_i to get the first pair |
---|
1275 | end |
---|
1276 | Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2)); |
---|
1277 | pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit]; |
---|
1278 | end |
---|
1279 | displ_pair=[displ_pair;{pair_string}]; |
---|
1280 | end |
---|
1281 | end |
---|
1282 | if ~isempty(displ_pair) |
---|
1283 | displ_pair=[displ_pair;{'Dj=*|*'}]; |
---|
1284 | end |
---|
1285 | elseif strcmp(mode,'bursts') |
---|
1286 | if isempty(j2_series) |
---|
1287 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
1288 | return |
---|
1289 | end |
---|
1290 | diff_j=j2_series-j1_series; |
---|
1291 | min_j1=min(j1_series(j1_series>0)); |
---|
1292 | max_j1=max(j1_series(j1_series>0)); |
---|
1293 | min_j2=min(j2_series(j2_series>0)); |
---|
1294 | max_j2=max(j2_series(j2_series>0)); |
---|
1295 | for pair1=min_j1:min(max_j1,min_j1+20) |
---|
1296 | for pair2=min_j2:min(max_j2,min_j2+20) |
---|
1297 | if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0 |
---|
1298 | displ_pair=[displ_pair;{['j= ' num2str(pair1) '-' num2str(pair2)]}]; |
---|
1299 | end |
---|
1300 | end |
---|
1301 | end |
---|
1302 | if ~isempty(displ_pair) |
---|
1303 | displ_pair=[displ_pair;{'j=*-*'}]; |
---|
1304 | end |
---|
1305 | end |
---|
1306 | set(handles.num_ref_i,'String',num2str(ref_i)) % update ref_i and ref_j |
---|
1307 | set(handles.num_ref_j,'String',num2str(ref_j)) |
---|
1308 | |
---|
1309 | %% display list of pairstring |
---|
1310 | displ_pair_list=get(handles.ListPairs,'String'); |
---|
1311 | NewVal=[]; |
---|
1312 | if ~isempty(displ_pair_list) |
---|
1313 | Val=get(handles.ListPairs,'Value'); |
---|
1314 | NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pï¿œir |
---|
1315 | end |
---|
1316 | if ~isempty(NewVal) |
---|
1317 | set(handles.ListPairs,'Value',NewVal) |
---|
1318 | else |
---|
1319 | set(handles.ListPairs,'Value',1) |
---|
1320 | end |
---|
1321 | set(handles.ListPairs,'String',displ_pair) |
---|
1322 | |
---|
1323 | %------------------------------------- |
---|
1324 | function enable_i(handles,state) |
---|
1325 | set(handles.i_txt,'Visible',state) |
---|
1326 | set(handles.num_first_i,'Visible',state) |
---|
1327 | set(handles.num_last_i,'Visible',state) |
---|
1328 | set(handles.num_incr_i,'Visible',state) |
---|
1329 | % set(handles.num_MaxIndex_i,'Visible',state) |
---|
1330 | set(handles.num_ref_i,'Visible',state) |
---|
1331 | set(handles.ref_i_text,'Visible',state) |
---|
1332 | |
---|
1333 | %----------------------------------- |
---|
1334 | function enable_j(handles,state) |
---|
1335 | set(handles.j_txt,'Visible',state) |
---|
1336 | % set(handles.num_MinIndex_j,'Visible',state) |
---|
1337 | set(handles.num_first_j,'Visible',state) |
---|
1338 | set(handles.num_last_j,'Visible',state) |
---|
1339 | set(handles.num_incr_j,'Visible',state) |
---|
1340 | % set(handles.num_MaxIndex_j,'Visible',state) |
---|
1341 | set(handles.num_ref_j,'Visible',state) |
---|
1342 | set(handles.ref_j_text,'Visible',state) |
---|
1343 | |
---|
1344 | |
---|
1345 | %%%%%%%%%%%%%%%%%%%% |
---|
1346 | %% MAIN ActionName FUNCTIONS |
---|
1347 | %%%%%%%%%%%%%%%%%%%% |
---|
1348 | %------------------------------------------------------------------------ |
---|
1349 | % --- Executes on button press in RUN. |
---|
1350 | function RUN_Callback(hObject, eventdata, handles) |
---|
1351 | %------------------------------------------------------------------------ |
---|
1352 | set(handles.RUN,'BusyAction','queue'); |
---|
1353 | set(0,'CurrentFigure',handles.series) |
---|
1354 | set(handles.RUN, 'Enable','Off') |
---|
1355 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
1356 | drawnow |
---|
1357 | [h_fun,Series,filexml,errormsg]=prepare_jobs(handles); |
---|
1358 | if ~isempty(errormsg) |
---|
1359 | msgbox_uvmat('ERROR',errormsg) |
---|
1360 | return |
---|
1361 | end |
---|
1362 | RunModeList=get(handles.RunMode,'String'); |
---|
1363 | RunMode=RunModeList{get(handles.RunMode,'Value')}; |
---|
1364 | |
---|
1365 | switch RunMode |
---|
1366 | case 'local' |
---|
1367 | Series=h_fun(Series); |
---|
1368 | if ~isempty(filexml) |
---|
1369 | t=struct2xml(Series); |
---|
1370 | t=set(t,1,'name','Series'); |
---|
1371 | save(t,filexml); |
---|
1372 | end |
---|
1373 | case 'background' |
---|
1374 | if isempty(filexml) |
---|
1375 | Series=h_fun(Series);% no background in the absence of output file |
---|
1376 | else |
---|
1377 | % update the xml file after interactive input with the function |
---|
1378 | Series.Specific='?'; |
---|
1379 | Series=h_fun(Series); |
---|
1380 | t=struct2xml(Series); |
---|
1381 | t=set(t,1,'name','Series'); |
---|
1382 | save(t,filexml); |
---|
1383 | path_uvmat=fileparts(which('uvmat')); |
---|
1384 | |
---|
1385 | filename_bat=regexprep(filexml,'.xml$','.bat'); |
---|
1386 | [fid,message]=fopen(filename_bat,'w'); |
---|
1387 | if isequal(fid,-1) |
---|
1388 | msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); |
---|
1389 | return |
---|
1390 | end |
---|
1391 | path_fct=get(handles.ActionPath,'String'); |
---|
1392 | filelog=regexprep(filexml,'.xml$','.log'); |
---|
1393 | |
---|
1394 | switch computer |
---|
1395 | case {'GLNX86','GLNXA64','MACI64'} |
---|
1396 | text_matlabscript=[... |
---|
1397 | '#!/bin/bash \n'... |
---|
1398 | '. /etc/sysprofile \n'... |
---|
1399 | 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog ''' <<END_MATLAB \n'... |
---|
1400 | 'addpath(''' path_uvmat '''); \n'... |
---|
1401 | 'addpath(''' Series.Action.ActionPath '''); \n'... |
---|
1402 | '' Series.Action.ActionName '( ''' filexml '''); \n'... |
---|
1403 | 'exit \n'... |
---|
1404 | 'END_MATLAB \n']; |
---|
1405 | fprintf(fid,text_matlabscript); |
---|
1406 | fclose(fid); |
---|
1407 | system(['chmod +x ' filename_bat]);% set the file to executable |
---|
1408 | system(['. ' filename_bat ' &']);%execute fct |
---|
1409 | |
---|
1410 | case {'PCWIN','PCWIN64'} |
---|
1411 | text_matlabscript=['matlab -automation -logfile ' regexprep(filelog,'\\','\\\\')... |
---|
1412 | ' -r "addpath(''' regexprep(path_uvmat,'\\','\\\\') ''');'... |
---|
1413 | 'addpath(''' regexprep(Series.Action.ActionPath,'\\','\\\\') ''');'... |
---|
1414 | '' Series.Action.ActionName '( ''' regexprep(filexml,'\\','\\\\') ''');exit"']; |
---|
1415 | fprintf(fid,text_matlabscript); |
---|
1416 | fclose(fid); |
---|
1417 | dos([filename_bat ' &']); |
---|
1418 | end |
---|
1419 | end |
---|
1420 | update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate lounching is finished |
---|
1421 | end |
---|
1422 | |
---|
1423 | set(handles.RUN, 'Enable','On') |
---|
1424 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1425 | |
---|
1426 | %------------------------------------------------------------------------ |
---|
1427 | function STOP_Callback(hObject, eventdata, handles) |
---|
1428 | %------------------------------------------------------------------------ |
---|
1429 | set(handles.RUN, 'BusyAction','cancel') |
---|
1430 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1431 | set(handles.RUN,'enable','on') |
---|
1432 | % set(handles.BATCH,'BackgroundColor',[1 0 0]) |
---|
1433 | % set(handles.BATCH,'enable','on') |
---|
1434 | |
---|
1435 | %------------------------------------------------------------------------ |
---|
1436 | % --- Executes on button press in BATCH. |
---|
1437 | function BATCH_Callback(hObject, eventdata, handles) |
---|
1438 | %------------------------------------------------------------------------ |
---|
1439 | |
---|
1440 | |
---|
1441 | % %------------------------------------------------------------------------ |
---|
1442 | % % --- Executes on button press in BIN. |
---|
1443 | % function BIN_Callback(hObject, eventdata, handles) |
---|
1444 | % %------------------------------------------------------------------------ |
---|
1445 | % cmd=['#!/bin/bash \n '... |
---|
1446 | % '#$ -cwd \n '... |
---|
1447 | % 'hostname && date \n '... |
---|
1448 | % 'umask 002 \n'... |
---|
1449 | % Param.xml.CivmBin ' ' Param.xml.RunTime ' ' filename_xml ' ' OutputFile '.nc']; |
---|
1450 | % |
---|
1451 | %------------------------------------------------------------------------ |
---|
1452 | % --- Main launch command, called by RUN and BATCH |
---|
1453 | function [h_fun,Series,filexml,errormsg]=prepare_jobs(handles,run) |
---|
1454 | %INPUT: |
---|
1455 | % handles: handles of graphic objects on the GUI series |
---|
1456 | % run=0, just to display parameters for MenuExport/GUI config |
---|
1457 | % run=1 (default) prepare the computation |
---|
1458 | |
---|
1459 | %------------------------------------------------------------------------ |
---|
1460 | h_fun=[]; |
---|
1461 | filexml=''; |
---|
1462 | errormsg=''; |
---|
1463 | if ~exist('run','var') |
---|
1464 | run=1; |
---|
1465 | end |
---|
1466 | %% Read parameters from series |
---|
1467 | Series=read_GUI(handles.series); |
---|
1468 | if isfield(Series,'Pairs') |
---|
1469 | Series=rmfield(Series,'Pairs'); %info Pairs not needed for output |
---|
1470 | end |
---|
1471 | |
---|
1472 | %% read index ranges |
---|
1473 | first_i=1; |
---|
1474 | last_i=1; |
---|
1475 | incr_i=1; |
---|
1476 | first_j=1; |
---|
1477 | last_j=1; |
---|
1478 | incr_j=1; |
---|
1479 | if isfield(Series.IndexRange,'first_i') |
---|
1480 | first_i=Series.IndexRange.first_i; |
---|
1481 | incr_i=Series.IndexRange.incr_i; |
---|
1482 | last_i=Series.IndexRange.last_i; |
---|
1483 | end |
---|
1484 | if isfield(Series.IndexRange,'first_j') |
---|
1485 | first_j=Series.IndexRange.first_j; |
---|
1486 | incr_j=Series.IndexRange.incr_j; |
---|
1487 | last_j=Series.IndexRange.last_j; |
---|
1488 | end |
---|
1489 | |
---|
1490 | %% read input file parameters and set menus |
---|
1491 | menu_coord_state=get(handles.TransformName,'Visible'); |
---|
1492 | if isequal(menu_coord_state,'on') |
---|
1493 | menu_index=get(handles.TransformName,'Value'); |
---|
1494 | transform_list=get(handles.TransformName,'UserData'); |
---|
1495 | Series.FieldTransform.TransformHandle=transform_list{menu_index};% transform function handles |
---|
1496 | end |
---|
1497 | |
---|
1498 | if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... |
---|
1499 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1500 | |
---|
1501 | %% projection object |
---|
1502 | if isfield(Series,'CheckObject') |
---|
1503 | if Series.CheckObject |
---|
1504 | hset_object=findobj(allchild(0),'tag','set_object'); |
---|
1505 | Series.ProjObject=read_GUI(hset_object); |
---|
1506 | CheckObject_Callback([], [], handles) |
---|
1507 | end |
---|
1508 | else |
---|
1509 | Series.CheckObject=0; |
---|
1510 | end |
---|
1511 | |
---|
1512 | %% get_field GUI |
---|
1513 | if isfield(Series,'InputFields')&&isfield(Series.InputFields,'Field') |
---|
1514 | if strcmp(Series.InputFields.Field,'get_field...') |
---|
1515 | hget_field=findobj(allchild(0),'name','get_field'); |
---|
1516 | Series.GetField=read_GUI(hget_field); |
---|
1517 | end |
---|
1518 | end |
---|
1519 | |
---|
1520 | if ~run |
---|
1521 | return |
---|
1522 | end |
---|
1523 | |
---|
1524 | %% defining the ActionName function handle |
---|
1525 | list_action=get(handles.ActionName,'String');% list menu action |
---|
1526 | index=get(handles.ActionName,'Value'); |
---|
1527 | action= list_action{index}; % selected string |
---|
1528 | %Series.Action=action;%name of the processing programme |
---|
1529 | Series.hseries=handles.series; % handles to the series GUI |
---|
1530 | path_series=which('series'); |
---|
1531 | list_path=get(handles.ActionName,'UserData'); |
---|
1532 | fct_path=list_path{index}; %path stored for the function ACTION |
---|
1533 | if ~isequal(fct_path,path_series) |
---|
1534 | eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION |
---|
1535 | if ~exist(fct_path,'dir') |
---|
1536 | errormsg=['The prescribed function path ' fct_path ' does not exist']; |
---|
1537 | return |
---|
1538 | end |
---|
1539 | if ~isequal(spath,fct_path) |
---|
1540 | addpath(fct_path)% add the prescribed path if not the current one |
---|
1541 | end |
---|
1542 | end |
---|
1543 | eval(['h_fun=@' action ';'])%create a function handle for ACTION |
---|
1544 | if ~isequal(fct_path,path_series) |
---|
1545 | rmpath(fct_path)% add the prescribed path if not the current one |
---|
1546 | end |
---|
1547 | |
---|
1548 | %% create the output data directory and write in it the xml file from the GUI config |
---|
1549 | %determine the root file corresponding to the first sub dir |
---|
1550 | if isfield(Series,'OutputSubDir') |
---|
1551 | SubDirOut=[Series.OutputSubDir Series.OutputDirExt]; |
---|
1552 | SubDirOutNew=SubDirOut; |
---|
1553 | iview=1; |
---|
1554 | SeriesData=get(handles.series,'UserData'); |
---|
1555 | if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && isfield(SeriesData.AllowInputSort) |
---|
1556 | [tild,iview]=sort(Series.InputTable(:,2)); %subdirectories sorted in alphabetical order |
---|
1557 | Series.InputTable=Series.InputTable(iview,:); |
---|
1558 | end |
---|
1559 | detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exist |
---|
1560 | check_create=1; %need to create the result directory by default |
---|
1561 | while detect |
---|
1562 | answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' fullfile(Series.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']); |
---|
1563 | if isequal(answer,'Yes') |
---|
1564 | detect=0; |
---|
1565 | check_create=0; |
---|
1566 | else |
---|
1567 | r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number |
---|
1568 | if isempty(r) |
---|
1569 | r(1).root=[SubDirOutNew '_']; |
---|
1570 | r(1).num1='0'; |
---|
1571 | end |
---|
1572 | SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 |
---|
1573 | detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exists |
---|
1574 | check_create=1; |
---|
1575 | end |
---|
1576 | end |
---|
1577 | Series.OutputDirExt=regexprep(SubDirOutNew,Series.OutputSubDir,''); |
---|
1578 | % Series.OutputSubDir=SubDirOutNew; |
---|
1579 | % Series.OutputDir=fullfile(Series.InputTable{1,1},Series.OutputSubDir);%directory set for output results |
---|
1580 | Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output |
---|
1581 | set(handles.OutputDirExt,'String',Series.OutputDirExt) |
---|
1582 | % create output directory |
---|
1583 | OutputDir=fullfile(Series.InputTable{1,1},[Series.OutputSubDir Series.OutputDirExt]); |
---|
1584 | if check_create |
---|
1585 | [tild,msg1]=mkdir(OutputDir); |
---|
1586 | if ~strcmp(msg1,'') |
---|
1587 | errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation |
---|
1588 | return |
---|
1589 | end |
---|
1590 | end |
---|
1591 | filexml=fullfile(OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory |
---|
1592 | end |
---|
1593 | %removes redondant information |
---|
1594 | Series.IndexRange=rmfield(Series.IndexRange,'TimeTable'); |
---|
1595 | Series.IndexRange=rmfield(Series.IndexRange,'MinIndex'); |
---|
1596 | Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex'); |
---|
1597 | %removes empty lines of InputTable |
---|
1598 | empty_line=zeros(size(Series.InputTable,1),1); |
---|
1599 | for iline=1:size(Series.InputTable,1) |
---|
1600 | empty_line(iline)=isequal(Series.InputTable(iline,1:3),{'','',''}); |
---|
1601 | end |
---|
1602 | Series.InputTable(find(empty_line),:)=[]; |
---|
1603 | |
---|
1604 | %------------------------------------------------------------------------ |
---|
1605 | % --- Executes on selection change in ActionName. |
---|
1606 | function ActionName_Callback(hObject, eventdata, handles) |
---|
1607 | %------------------------------------------------------------------------ |
---|
1608 | global nb_builtin_ACTION |
---|
1609 | list_ACTION=get(handles.ActionName,'String');% list menu fields |
---|
1610 | index_ACTION=get(handles.ActionName,'Value');% selected string index |
---|
1611 | ACTION= list_ACTION{index_ACTION}; % selected function name |
---|
1612 | path_series=which('series');%path to series.m |
---|
1613 | list_path=get(handles.ActionName,'UserData');%list of recorded paths to functions of the list ACTION |
---|
1614 | default_file=fullfile(list_path{end},ACTION); |
---|
1615 | % add a new function to the menu if the selected item is 'more...' |
---|
1616 | if isequal(ACTION,'more...') |
---|
1617 | pathfct=fileparts(path_series); |
---|
1618 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1619 | {'*.m', ' (*.m)'; |
---|
1620 | '*.m', '.m files '; ... |
---|
1621 | '*.*', 'All Files (*.*)'}, ... |
---|
1622 | 'Pick a file',default_file); |
---|
1623 | if length(FileName)<2 |
---|
1624 | return |
---|
1625 | end |
---|
1626 | [pp,ACTION,ext_fct]=fileparts(FileName);%(end-1:end); |
---|
1627 | if ~isequal(ext_fct,'.m') |
---|
1628 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
1629 | return |
---|
1630 | end |
---|
1631 | |
---|
1632 | % insert the choice in the actionname menu |
---|
1633 | menu_str=update_menu(handles.ActionName,ACTION);%new action menu in which the new item has been appended if needed |
---|
1634 | index_ACTION=get(handles.ActionName,'Value');% currently selected index in the list |
---|
1635 | list_path{index_ACTION}=PathName; |
---|
1636 | if length(menu_str)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu |
---|
1637 | nbremove=length(menu_str)-nb_builtin_ACTION-5; |
---|
1638 | menu_str(nb_builtin_ACTION+1:end-5)=[]; |
---|
1639 | list_path(nb_builtin_ACTION+1:end-4)=[]; |
---|
1640 | index_ACTION=index_ACTION-nbremove; |
---|
1641 | set(handles.ActionName,'Value',index_ACTION) |
---|
1642 | set(handles.ActionName,'String',menu_str) |
---|
1643 | end |
---|
1644 | list_path{index_ACTION}=PathName; |
---|
1645 | set(handles.ActionName,'UserData',list_path); |
---|
1646 | set(handles.ActionPath,'enable','inactive')% indicate that the current path is accessible (not 'off') |
---|
1647 | |
---|
1648 | %record the current menu in personal file profil_perso |
---|
1649 | dir_perso=prefdir; |
---|
1650 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
1651 | for ilist=nb_builtin_ACTION+1:length(menu_str)-1 |
---|
1652 | series_fct{ilist-nb_builtin_ACTION}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); |
---|
1653 | end |
---|
1654 | if nb_builtin_ACTION+1<=length(menu_str)-1 |
---|
1655 | if exist(profil_perso,'file')% && nb_builtin_ACTION+1>=length(menu_str)-1 |
---|
1656 | save(profil_perso,'series_fct','-append') |
---|
1657 | else |
---|
1658 | txt=ver('MATLAB'); |
---|
1659 | Release=txt.Release; |
---|
1660 | relnumb=str2num(Release(3:4)); |
---|
1661 | if relnumb >= 14%recent relaese of Matlab |
---|
1662 | save(profil_perso,'series_fct','-V6') |
---|
1663 | else |
---|
1664 | save(profil_perso, 'series_fct') |
---|
1665 | end |
---|
1666 | end |
---|
1667 | end |
---|
1668 | end |
---|
1669 | |
---|
1670 | %check the current ActionPath to the selected function |
---|
1671 | PathName=list_path{index_ACTION};%current recorded path |
---|
1672 | set(handles.ActionPath,'String',PathName); %show the path to the senlected function |
---|
1673 | |
---|
1674 | %reinitialise the waitbar |
---|
1675 | update_waitbar(handles.Waitbar,0) |
---|
1676 | |
---|
1677 | %default setting for the visibility of the GUI elements |
---|
1678 | set(handles.num_NbSlice,'Visible','off') |
---|
1679 | set(handles.NbSlice_title,'Visible','off') |
---|
1680 | set(handles.VelType,'Visible','off'); |
---|
1681 | set(handles.VelType_text,'Visible','off'); |
---|
1682 | set(handles.VelType_1,'Visible','off'); |
---|
1683 | set(handles.VelType_text_1,'Visible','off'); |
---|
1684 | set(handles.InputFields,'Visible','off') |
---|
1685 | set(handles.FieldName_1,'Visible','off') |
---|
1686 | %view_FieldMenu_1(handles,'off') |
---|
1687 | set(handles.FieldTransform,'Visible','off') |
---|
1688 | set(handles.CheckObject,'Visible','off'); |
---|
1689 | set(handles.ProjObject,'Visible','off'); |
---|
1690 | set(handles.CheckMask,'Visible','off') |
---|
1691 | set(handles.Mask,'Visible','off') |
---|
1692 | set(handles.OutputDirExt,'Visible','off') |
---|
1693 | set(handles.OutputSubDir,'Visible','off') |
---|
1694 | set(handles.OutputDir_title,'Visible','off') |
---|
1695 | %set the displayed GUI item needed for input parameters |
---|
1696 | if ~isequal(path_series,PathName) |
---|
1697 | addpath(PathName) |
---|
1698 | end |
---|
1699 | eval(['h_function=@' ACTION ';']); |
---|
1700 | try |
---|
1701 | [fid,errormsg] =fopen([ACTION '.m']); |
---|
1702 | InputText=textscan(fid,'%s',1,'delimiter','\n'); |
---|
1703 | fclose(fid) |
---|
1704 | set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help |
---|
1705 | end |
---|
1706 | if ~isequal(path_series,PathName) |
---|
1707 | rmpath(PathName) |
---|
1708 | end |
---|
1709 | varargout=h_function(); |
---|
1710 | Param_list={}; |
---|
1711 | |
---|
1712 | InputTable=get(handles.InputTable,'Data'); |
---|
1713 | nbview=size(InputTable,1); |
---|
1714 | SeriesData=get(handles.series,'UserData'); |
---|
1715 | nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType))); |
---|
1716 | nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType))); |
---|
1717 | for ilist=1:length(varargout)-1 |
---|
1718 | switch varargout{ilist} |
---|
1719 | case 'AllowInputSort' |
---|
1720 | if isequal(lower(varargout{ilist+1}),'on')% sort the input table by alphabetical order of the SubDir |
---|
1721 | SeriesData.AllowInputSort=1; |
---|
1722 | set(handles.series,'UserData',SeriesData) |
---|
1723 | end |
---|
1724 | case 'WholeIndexRange' |
---|
1725 | if isequal(lower(varargout{ilist+1}),'on')% set by default the input index range from min to max |
---|
1726 | MinIndex=get(handles.MinIndex,'Data'); |
---|
1727 | MaxIndex=get(handles.MaxIndex,'Data'); |
---|
1728 | if ~isempty(MinIndex) |
---|
1729 | set(handles.num_first_i,'String',num2str(MinIndex{1})) |
---|
1730 | set(handles.num_last_i,'String',num2str(MaxIndex{1})) |
---|
1731 | set(handles.num_incr_i,'String','1') |
---|
1732 | if size(MinIndex,2)>=2 |
---|
1733 | set(handles.num_first_j,'String',num2str(MinIndex{1,2})) |
---|
1734 | set(handles.num_last_j,'String',num2str(MaxIndex{1,2})) |
---|
1735 | set(handles.num_incr_j,'String','1') |
---|
1736 | end |
---|
1737 | end |
---|
1738 | end |
---|
1739 | case 'NbSlice' %hidden by default |
---|
1740 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1741 | set(handles.num_NbSlice,'Visible','on') |
---|
1742 | set(handles.NbSlice_title,'Visible','on') |
---|
1743 | end |
---|
1744 | case 'VelType' %hidden by default |
---|
1745 | if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') |
---|
1746 | if nb_civ>=1 |
---|
1747 | set(handles.VelType,'Visible','on') |
---|
1748 | set(handles.VelType_text,'Visible','on'); |
---|
1749 | end |
---|
1750 | end |
---|
1751 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1752 | if nb_civ>=2 |
---|
1753 | set(handles.VelType_1,'Visible','on') |
---|
1754 | set(handles.VelType_text_1,'Visible','on'); |
---|
1755 | end |
---|
1756 | end |
---|
1757 | case 'FieldName' %hidden by default |
---|
1758 | if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') |
---|
1759 | if (nb_civ+nb_netcdf)>=1 |
---|
1760 | set(handles.FieldName,'Visible','on') % test for MenuBorser |
---|
1761 | set(handles.InputFields,'Visible','on') |
---|
1762 | end |
---|
1763 | end |
---|
1764 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1765 | if (nb_civ+nb_netcdf)>=1 |
---|
1766 | set(handles.FieldName_1,'Visible','on') |
---|
1767 | end |
---|
1768 | end |
---|
1769 | case 'FieldTransform' %hidden by default |
---|
1770 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1771 | set(handles.TransformName,'Enable','on') |
---|
1772 | set(handles.FieldTransform,'Visible','on') |
---|
1773 | TransformName_Callback([],[], handles) |
---|
1774 | end |
---|
1775 | case 'ProjObject' %hidden by default |
---|
1776 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1777 | set(handles.CheckObject,'Visible','on') |
---|
1778 | set(handles.ProjObject,'Visible','on') |
---|
1779 | end |
---|
1780 | case 'Mask' %hidden by default |
---|
1781 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1782 | set(handles.Mask,'Visible','on') |
---|
1783 | set(handles.CheckMask,'Visible','on'); |
---|
1784 | end |
---|
1785 | case 'OutputDirExt' |
---|
1786 | if ~isempty(varargout{ilist+1}) |
---|
1787 | set(handles.OutputDirExt,'String',varargout{ilist+1}) |
---|
1788 | set(handles.OutputDirExt,'Visible','on') |
---|
1789 | set(handles.OutputSubDir,'Visible','on') |
---|
1790 | set(handles.OutputDir_title,'Visible','on') |
---|
1791 | end |
---|
1792 | end |
---|
1793 | end |
---|
1794 | if ~isempty(Param_list) |
---|
1795 | set(handles.ParamKey,'String',Param_list) |
---|
1796 | set(handles.ParamVal,'Visible','on') |
---|
1797 | end |
---|
1798 | |
---|
1799 | %------------------------------------------------------------------------ |
---|
1800 | % --- Executes on selection change in FieldName. |
---|
1801 | function FieldName_Callback(hObject, eventdata, handles) |
---|
1802 | %------------------------------------------------------------------------ |
---|
1803 | field_str=get(handles.FieldName,'String'); |
---|
1804 | field_index=get(handles.FieldName,'Value'); |
---|
1805 | field=field_str{field_index(1)}; |
---|
1806 | if isequal(field,'get_field...') |
---|
1807 | hget_field=findobj(allchild(0),'name','get_field'); |
---|
1808 | if ~isempty(hget_field) |
---|
1809 | delete(hget_field)%delete opened versions of get_field |
---|
1810 | end |
---|
1811 | filecell=get_file_series(read_GUI(handles.series)); |
---|
1812 | if exist(filecell{1,1},'file') |
---|
1813 | get_field(filecell{1,1}) |
---|
1814 | end |
---|
1815 | elseif isequal(field,'more...') |
---|
1816 | str=calc_field; |
---|
1817 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
1818 | 'SelectionMode','single',... |
---|
1819 | 'ListString',str); |
---|
1820 | % edit the choice in the fields and actionname menu |
---|
1821 | scalar=cell2mat(str(ind_answer)); |
---|
1822 | update_menu(handles.FieldName,scalar) |
---|
1823 | end |
---|
1824 | |
---|
1825 | %------------------------------------------------------------------------ |
---|
1826 | % --- Executes on selection change in FieldName_1. |
---|
1827 | function FieldName_1_Callback(hObject, eventdata, handles) |
---|
1828 | %------------------------------------------------------------------------ |
---|
1829 | field_str=get(handles.FieldName_1,'String'); |
---|
1830 | field_index=get(handles.FieldName_1,'Value'); |
---|
1831 | field=field_str{field_index}; |
---|
1832 | if isequal(field,'get_field...') |
---|
1833 | hget_field=findobj(allchild(0),'name','get_field_1'); |
---|
1834 | if ~isempty(hget_field) |
---|
1835 | delete(hget_field) |
---|
1836 | end |
---|
1837 | SeriesData=get(handles.series,'UserData'); |
---|
1838 | filename=SeriesData.CurrentInputFile_1; |
---|
1839 | if exist(filename,'file') |
---|
1840 | hget_field=get_field(filename); |
---|
1841 | set(hget_field,'name','get_field_1') |
---|
1842 | end |
---|
1843 | elseif isequal(field,'more...') |
---|
1844 | str=calc_field; |
---|
1845 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
1846 | 'SelectionMode','single',... |
---|
1847 | 'ListString',str); |
---|
1848 | % edit the choice in the fields and actionname menu |
---|
1849 | scalar=cell2mat(str(ind_answer)); |
---|
1850 | update_menu(handles.FieldName_1,scalar) |
---|
1851 | end |
---|
1852 | |
---|
1853 | |
---|
1854 | %%%%%%%%%%%%% |
---|
1855 | function [ind_remove]=find_pairs(dirpair,ind_i,last_i) |
---|
1856 | indsel=ind_i; |
---|
1857 | indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series |
---|
1858 | indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds |
---|
1859 | if ~isempty(indiff) |
---|
1860 | indiff2=diff(indiff); |
---|
1861 | indiffp=[indiff2 1]; |
---|
1862 | indiffm=[1 indiff2]; |
---|
1863 | ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets |
---|
1864 | ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets |
---|
1865 | %for each multiplet, select the most recent file |
---|
1866 | ind_remove=[]; |
---|
1867 | for i=1:length(ind_multi_m) |
---|
1868 | ind_pairs=ind_multi_m(i):ind_multi_p(i); |
---|
1869 | for imulti=1:length(ind_pairs) |
---|
1870 | datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation |
---|
1871 | end |
---|
1872 | [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date |
---|
1873 | ind_s=indsort2(1:end-1);% |
---|
1874 | ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one |
---|
1875 | end |
---|
1876 | end |
---|
1877 | |
---|
1878 | %------------------------------------------------------------------------ |
---|
1879 | % --- determine the list of index pairstring of processing file |
---|
1880 | function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) |
---|
1881 | %------------------------------------------------------------------------ |
---|
1882 | num_i1=num_i;% set of first image numbers by default |
---|
1883 | num_i2=num_i; |
---|
1884 | num_j1=num_j; |
---|
1885 | num_j2=num_j; |
---|
1886 | num_i_out=num_i; |
---|
1887 | num_j_out=num_j; |
---|
1888 | % if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2') |
---|
1889 | if isequal(mode,'series(Di)') |
---|
1890 | num_i1_line=num_i+ind_shift(3);% set of first image numbers |
---|
1891 | num_i2_line=num_i+ind_shift(4); |
---|
1892 | % adjust the first and last field number |
---|
1893 | indsel=find(num_i1_line >= 1); |
---|
1894 | num_i_out=num_i(indsel); |
---|
1895 | num_i1_line=num_i1_line(indsel); |
---|
1896 | num_i2_line=num_i2_line(indsel); |
---|
1897 | num_j1=meshgrid(num_j,ones(size(num_i1_line))); |
---|
1898 | num_j2=meshgrid(num_j,ones(size(num_i1_line))); |
---|
1899 | [xx,num_i1]=meshgrid(num_j,num_i1_line); |
---|
1900 | [xx,num_i2]=meshgrid(num_j,num_i2_line); |
---|
1901 | elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts') |
---|
1902 | if isequal(mode,'bursts') %case of bursts (png_old or png_2D) |
---|
1903 | num_j1=ind_shift(1)*ones(size(num_i)); |
---|
1904 | num_j2=ind_shift(2)*ones(size(num_i)); |
---|
1905 | else |
---|
1906 | num_j1_col=num_j+ind_shift(1);% set of first image numbers |
---|
1907 | num_j2_col=num_j+ind_shift(2); |
---|
1908 | % adjust the first field number |
---|
1909 | indsel=find((num_j1_col >= 1)); |
---|
1910 | num_j_out=num_j(indsel); |
---|
1911 | num_j1_col=num_j1_col(indsel); |
---|
1912 | num_j2_col=num_j2_col(indsel); |
---|
1913 | [num_i1,num_j1]=meshgrid(num_i,num_j1_col); |
---|
1914 | [num_i2,num_j2]=meshgrid(num_i,num_j2_col); |
---|
1915 | end |
---|
1916 | end |
---|
1917 | |
---|
1918 | %------------------------------------------------------------------------ |
---|
1919 | % --- Executes on button press in CheckObject. |
---|
1920 | function CheckObject_Callback(hObject, eventdata, handles) |
---|
1921 | %------------------------------------------------------------------------ |
---|
1922 | % SeriesData=get(handles.series,'UserData'); |
---|
1923 | value=get(handles.CheckObject,'Value'); |
---|
1924 | if value |
---|
1925 | set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow |
---|
1926 | hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle |
---|
1927 | if ishandle(hset_object) |
---|
1928 | uistack(hset_object,'top')% show the GUI set_object if opened |
---|
1929 | else |
---|
1930 | %get the object file |
---|
1931 | InputTable=get(handles.InputTable,'Data'); |
---|
1932 | defaultname=InputTable{1,1}; |
---|
1933 | if isempty(defaultname) |
---|
1934 | defaultname={''}; |
---|
1935 | end |
---|
1936 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1937 | {'*.xml;*.mat', ' (*.xml,*.mat)'; |
---|
1938 | '*.xml', '.xml files '; ... |
---|
1939 | '*.mat', '.mat matlab files '}, ... |
---|
1940 | 'Pick an xml object file (or use uvmat to create it)',defaultname); |
---|
1941 | fileinput=[PathName FileName];%complete file name |
---|
1942 | sizf=size(fileinput); |
---|
1943 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end |
---|
1944 | %read the file |
---|
1945 | data=xml2struct(fileinput); |
---|
1946 | if ~isfield(data,'Type') |
---|
1947 | msgbox_uvmat('ERROR',[fileinput ' is not an object xml file']) |
---|
1948 | return |
---|
1949 | end |
---|
1950 | if ~isfield(data,'ProjMode') |
---|
1951 | data.ProjMode='none'; |
---|
1952 | end |
---|
1953 | hset_object=set_object(data);% call the set_object interface |
---|
1954 | end |
---|
1955 | Object=read_GUI(hset_object); |
---|
1956 | set(handles.ProjObject,'String',Object.Name);%display the object name |
---|
1957 | else |
---|
1958 | set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green |
---|
1959 | end |
---|
1960 | %set(handles.series,'UserData',SeriesData) |
---|
1961 | |
---|
1962 | %-------------------------------------------------------------- |
---|
1963 | function CheckMask_Callback(hObject, eventdata, handles) |
---|
1964 | value=get(handles.CheckMask,'Value'); |
---|
1965 | if value |
---|
1966 | msgbox_uvmat('ERROR','not implemented yet') |
---|
1967 | end |
---|
1968 | %-------------------------------------------------------------- |
---|
1969 | |
---|
1970 | %------------------------------------------------------------------- |
---|
1971 | %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m' |
---|
1972 | function ncbrowser_uvmat(hObject, eventdata) |
---|
1973 | %------------------------------------------------------------------- |
---|
1974 | bla=get(gcbo,'String'); |
---|
1975 | ind=get(gcbo,'Value'); |
---|
1976 | filename=cell2mat(bla(ind)); |
---|
1977 | blank=find(filename==' '); |
---|
1978 | filename=filename(1:blank-1); |
---|
1979 | get_field(filename) |
---|
1980 | |
---|
1981 | % ------------------------------------------------------------------ |
---|
1982 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
1983 | %------------------------------------------------------------------- |
---|
1984 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
1985 | pathelp=fileparts(path_to_uvmat); |
---|
1986 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
1987 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') |
---|
1988 | else |
---|
1989 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
1990 | web([helpfile '#series']) |
---|
1991 | end |
---|
1992 | |
---|
1993 | %------------------------------------------------------------------- |
---|
1994 | % --- Executes on selection change in TransformName. |
---|
1995 | function TransformName_Callback(hObject, eventdata, handles) |
---|
1996 | %------------------------------------------------------------------- |
---|
1997 | global nb_transform |
---|
1998 | |
---|
1999 | menu=get(handles.TransformName,'String'); |
---|
2000 | ind_coord=get(handles.TransformName,'Value'); |
---|
2001 | coord_option=menu{ind_coord}; |
---|
2002 | list_transform=get(handles.TransformName,'UserData'); |
---|
2003 | ff=functions(list_transform{end}); |
---|
2004 | if isequal(coord_option,'more...'); |
---|
2005 | coord_fct=''; |
---|
2006 | prompt = {'Enter the name of the transform function'}; |
---|
2007 | dlg_title = 'user defined transform'; |
---|
2008 | num_lines= 1; |
---|
2009 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2010 | {'*.m', ' (*.m)'; |
---|
2011 | '*.m', '.m files '; ... |
---|
2012 | '*.*', 'All Files (*.*)'}, ... |
---|
2013 | 'Pick a file', ff.file); |
---|
2014 | if isequal(PathName(end),'/')||isequal(PathName(end),'\') |
---|
2015 | PathName(end)=[]; |
---|
2016 | end |
---|
2017 | transform_selected =fullfile(PathName,FileName); |
---|
2018 | if ~exist(transform_selected,'file') |
---|
2019 | return |
---|
2020 | end |
---|
2021 | [ppp,transform,xt_fct]=fileparts(FileName);% removes extension .m |
---|
2022 | if ~isequal(ext_fct,'.m') |
---|
2023 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
2024 | return |
---|
2025 | end |
---|
2026 | menu=update_menu(handles.TransformName,transform);%add the selected fct to the menu |
---|
2027 | ind_coord=get(handles.TransformName,'Value'); |
---|
2028 | addpath(PathName) |
---|
2029 | list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function |
---|
2030 | set(handles.TransformName,'UserData',list_transform) |
---|
2031 | rmpath(PathName) |
---|
2032 | % save the new menu in the personal file 'uvmat_perso.mat' |
---|
2033 | dir_perso=prefdir;%personal Matalb directory |
---|
2034 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
2035 | if exist(profil_perso,'file') |
---|
2036 | for ilist=nb_transform+1:numel(list_transform) |
---|
2037 | ff=functions(list_transform{ilist}); |
---|
2038 | transform_fct{ilist-nb_transform}=ff.file; |
---|
2039 | end |
---|
2040 | save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat |
---|
2041 | end |
---|
2042 | end |
---|
2043 | |
---|
2044 | %check the current ActionPath to the selected function |
---|
2045 | if ~isempty(list_transform{ind_coord}) |
---|
2046 | func=functions(list_transform{ind_coord}); |
---|
2047 | set(handles.TransformPath,'String',fileparts(func.file)); %show the path to the senlected function |
---|
2048 | else |
---|
2049 | set(handles.TransformPath,'String',''); %show the path to the senlected function |
---|
2050 | end |
---|
2051 | |
---|
2052 | |
---|
2053 | |
---|
2054 | % -------------------------------------------------------------------- |
---|
2055 | function MenuExportConfig_Callback(hObject, eventdata, handles) |
---|
2056 | global Series |
---|
2057 | [tild,Series,errormsg]=prepare_jobs(handles,0); |
---|
2058 | % Series=read_GUI(handles.series); |
---|
2059 | |
---|
2060 | evalin('base','global Series')%make CurData global in the workspace |
---|
2061 | display('current series config :') |
---|
2062 | evalin('base','Series') %display CurData in the workspace |
---|
2063 | commandwindow; %brings the Matlab command window to the front |
---|
2064 | |
---|
2065 | |
---|
2066 | % --- Executes on selection change in RunMode. |
---|
2067 | function RunMode_Callback(hObject, eventdata, handles) |
---|
2068 | |
---|
2069 | |
---|
2070 | % --- Executes on selection change in popupmenu14. |
---|
2071 | function popupmenu14_Callback(hObject, eventdata, handles) |
---|
2072 | % hObject handle to popupmenu14 (see GCBO) |
---|
2073 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2074 | % handles structure with handles and user data (see GUIDATA) |
---|
2075 | |
---|
2076 | % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu14 contents as cell array |
---|
2077 | % contents{get(hObject,'Value')} returns selected item from popupmenu14 |
---|
2078 | |
---|
2079 | |
---|
2080 | % --- Executes during object creation, after setting all properties. |
---|
2081 | function popupmenu14_CreateFcn(hObject, eventdata, handles) |
---|
2082 | % hObject handle to popupmenu14 (see GCBO) |
---|
2083 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
2084 | % handles empty - handles not created until after all CreateFcns called |
---|
2085 | |
---|
2086 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
2087 | % See ISPC and COMPUTER. |
---|
2088 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
2089 | set(hObject,'BackgroundColor','white'); |
---|
2090 | end |
---|