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 transform_fct (menu for coordinate transforms) |
---|
9 | % .menu_coord_val: value for transform_fct (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 | function varargout = series(varargin) |
---|
33 | |
---|
34 | % Begin initialization code - DO NOT EDIT |
---|
35 | gui_Singleton = 1; |
---|
36 | gui_State = struct('gui_Name', mfilename, ... |
---|
37 | 'gui_Singleton', gui_Singleton, ... |
---|
38 | 'gui_OpeningFcn', @series_OpeningFcn, ... |
---|
39 | 'gui_OutputFcn', @series_OutputFcn, ... |
---|
40 | 'gui_LayoutFcn', [] , ... |
---|
41 | 'gui_Callback', []); |
---|
42 | if nargin && ischar(varargin{1}) |
---|
43 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
44 | end |
---|
45 | |
---|
46 | if nargout |
---|
47 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
48 | else |
---|
49 | gui_mainfcn(gui_State, varargin{:}); |
---|
50 | end |
---|
51 | % End initialization code - DO NOT EDIT |
---|
52 | |
---|
53 | %-------------------------------------------------------------------------- |
---|
54 | % --- Executes just before series is made visible. |
---|
55 | %-------------------------------------------------------------------------- |
---|
56 | function series_OpeningFcn(hObject, eventdata, handles,param) |
---|
57 | global nb_builtin_ACTION nb_builtin_transform |
---|
58 | % Choose default command line output for series |
---|
59 | handles.output = hObject; |
---|
60 | % Update handles structure |
---|
61 | guidata(hObject, handles); |
---|
62 | %default initial parameters |
---|
63 | drawnow |
---|
64 | set(hObject,'Units','pixels') |
---|
65 | % set(0,'Units','pixels') |
---|
66 | % screensize=get(0,'ScreenSize'); %screen size in pixels |
---|
67 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) |
---|
68 | %set(hObject,'Position',[150 100 1000 600] );%position and size in pixels (get adjusted to the screen size in case of excess) |
---|
69 | %load the list of previously browsed files in menus Open and Open_1 |
---|
70 | dir_perso=prefdir; |
---|
71 | test_profil_perso=0; |
---|
72 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
73 | if exist(profil_perso,'file') |
---|
74 | h=load (profil_perso); |
---|
75 | test_profil_perso=1; |
---|
76 | if isfield(h,'MenuFile_1') |
---|
77 | set(handles.MenuFile_1,'Label',h.MenuFile_1); |
---|
78 | set(handles.MenuFile_insert_1,'Label',h.MenuFile_1); |
---|
79 | end |
---|
80 | if isfield(h,'MenuFile_1') |
---|
81 | set(handles.MenuFile_2,'Label',h.MenuFile_2); |
---|
82 | set(handles.MenuFile_insert_2,'Label',h.MenuFile_2); |
---|
83 | end |
---|
84 | if isfield(h,'MenuFile_1') |
---|
85 | set(handles.MenuFile_3,'Label',h.MenuFile_3); |
---|
86 | set(handles.MenuFile_insert_3,'Label',h.MenuFile_3); |
---|
87 | end |
---|
88 | if isfield(h,'MenuFile_1') |
---|
89 | set(handles.MenuFile_4,'Label',h.MenuFile_4); |
---|
90 | set(handles.MenuFile_insert_4,'Label',h.MenuFile_4); |
---|
91 | end |
---|
92 | if isfield(h,'MenuFile_1') |
---|
93 | set(handles.MenuFile_5,'Label',h.MenuFile_5); |
---|
94 | set(handles.MenuFile_insert_5,'Label',h.MenuFile_5); |
---|
95 | end |
---|
96 | end |
---|
97 | |
---|
98 | %check default input data |
---|
99 | if ~exist('param','var') |
---|
100 | param=[]; %default |
---|
101 | end |
---|
102 | |
---|
103 | %file name and browser initialisation |
---|
104 | if isfield(param,'menu_coord_str') |
---|
105 | set(handles.transform_fct,'String',param.menu_coord_str) |
---|
106 | end |
---|
107 | if isfield(param,'menu_coord_val') |
---|
108 | set(handles.transform_fct,'Value',param.menu_coord_val); |
---|
109 | else |
---|
110 | set(handles.transform_fct,'Value',1);%default |
---|
111 | end |
---|
112 | |
---|
113 | if isfield(param,'FileName') |
---|
114 | if isfield(param,'FileName_1') |
---|
115 | update_file(handles,param.FileName_1,0) |
---|
116 | update_file(handles,param.FileName,1) |
---|
117 | else |
---|
118 | update_file(handles,param.FileName,0) |
---|
119 | end |
---|
120 | end |
---|
121 | |
---|
122 | %fields input initialisation |
---|
123 | if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) |
---|
124 | set(handles.FieldMenu,'String',param.list_fields);% list menu fields |
---|
125 | set(handles.FieldMenu,'Value',param.index_fields);% selected string index |
---|
126 | FieldCell{1}=param.list_fields{param.index_fields}; |
---|
127 | end |
---|
128 | NomType_Callback(hObject, eventdata, handles) |
---|
129 | |
---|
130 | %loads the information stored in prefdir to initiate the list of ACTION functions |
---|
131 | fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; |
---|
132 | transform_menu={'';'phys';'px';'phys_polar'}; |
---|
133 | nb_builtin_ACTION=numel(fct_menu); %number of functions |
---|
134 | nb_transform=numel(transform_menu); |
---|
135 | [path_series,name,ext]=fileparts(which('series')); |
---|
136 | path_series=fullfile(path_series,'series');%path of the function 'series' |
---|
137 | 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) |
---|
138 | path_transform=fullfile(path_series,'transform_field');%path to the field transform functions |
---|
139 | for ilist=1:length(fct_menu) |
---|
140 | fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' |
---|
141 | end |
---|
142 | |
---|
143 | %TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions |
---|
144 | menu_str={'';'phys';'px';'phys_polar'}; |
---|
145 | nb_builtin_transform=numel(menu_str); %number of functions |
---|
146 | [path_uvmat,name,ext]=fileparts(which('uvmat')); |
---|
147 | addpath(fullfile(path_uvmat,'transform_field')) |
---|
148 | fct_handle{1,1}=[]; |
---|
149 | testexist(1)=1; |
---|
150 | for ilist=2:length(menu_str) |
---|
151 | if exist(menu_str{ilist},'file') |
---|
152 | fct_handle{ilist,1}=str2func(menu_str{ilist}); |
---|
153 | testexist(ilist)=1; |
---|
154 | else |
---|
155 | testexist(ilist)=0; |
---|
156 | end |
---|
157 | end |
---|
158 | rmpath(fullfile(path_uvmat,'transform_field')) |
---|
159 | |
---|
160 | % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir |
---|
161 | if test_profil_perso |
---|
162 | if isfield(h,'series_fct') && iscell(h.series_fct) |
---|
163 | for ilist=1:length(h.series_fct) |
---|
164 | [path,file]=fileparts(h.series_fct{ilist}); |
---|
165 | fct_path=[fct_path; {path}];%concatene the list of paths |
---|
166 | fct_menu=[fct_menu; {file}]; |
---|
167 | end |
---|
168 | end |
---|
169 | if isfield(h,'transform_fct') && iscell(h.transform_fct) |
---|
170 | for ilist=1:length(h.transform_fct); |
---|
171 | [path,file]=fileparts(h.transform_fct{ilist}); |
---|
172 | addpath(path) |
---|
173 | if exist(file,'file') |
---|
174 | h_func=str2func(file); |
---|
175 | testexist=[testexist 1]; |
---|
176 | else |
---|
177 | h_func=[]; |
---|
178 | testexist=[testexist 0]; |
---|
179 | end |
---|
180 | fct_handle=[fct_handle; {h_func}];%concatene the list of paths |
---|
181 | rmpath(path) |
---|
182 | menu_str=[menu_str; {file}]; |
---|
183 | end |
---|
184 | end |
---|
185 | end |
---|
186 | fct_menu=[fct_menu;{'more...'}]; |
---|
187 | set(handles.ACTION,'String',fct_menu) |
---|
188 | set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION |
---|
189 | |
---|
190 | menu_str=menu_str(find(testexist)); |
---|
191 | fct_handle=fct_handle(find(testexist)); |
---|
192 | menu_str=[menu_str;{'more...'}]; |
---|
193 | set(handles.transform_fct,'String',menu_str) |
---|
194 | set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION |
---|
195 | |
---|
196 | % display the GUI for the default action 'check_data_files' |
---|
197 | ACTION_Callback(hObject, eventdata, handles) |
---|
198 | |
---|
199 | %-------------------------------------------------------------- |
---|
200 | % --- Outputs from this function are returned to the command line. |
---|
201 | %----------------------------------------------------------------- |
---|
202 | function varargout = series_OutputFcn(hObject, eventdata, handles) |
---|
203 | % varargout cell array for returning output args (see VARARGOUT); |
---|
204 | % hObject handle to figure |
---|
205 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
206 | % handles structure with handles and user data (see GUIDATA) |
---|
207 | % Get default command line output from handles structure |
---|
208 | varargout{1} = handles.output; |
---|
209 | |
---|
210 | |
---|
211 | % -------------------------------------------------------------------- |
---|
212 | function MenuBrowse_Callback(hObject, eventdata, handles) |
---|
213 | |
---|
214 | RootPathCell=get(handles.RootPath,'String'); |
---|
215 | SubDirCell=get(handles.SubDir,'String'); |
---|
216 | RootFileCell=get(handles.RootFile,'String'); |
---|
217 | oldfile=''; %default |
---|
218 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
219 | dir_perso=prefdir; |
---|
220 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
221 | if exist(profil_perso,'file') |
---|
222 | h=load (profil_perso); |
---|
223 | if isfield(h,'filebase')&&ischar(h.filebase) |
---|
224 | oldfile=h.filebase; |
---|
225 | end |
---|
226 | if isfield(h,'RootPath')&&ischar(h.RootPath) |
---|
227 | oldfile=h.RootPath; |
---|
228 | end |
---|
229 | end |
---|
230 | else |
---|
231 | oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1}); |
---|
232 | end |
---|
233 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
234 | {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; |
---|
235 | '*.xml', '.xml files '; ... |
---|
236 | '*.xls', '.xls files '; ... |
---|
237 | '*.png','.png image files'; ... |
---|
238 | '*.tif','.tif image files'; ... |
---|
239 | '*.avi;*.AVI','.avi movie files'; ... |
---|
240 | '*.nc','.netcdf files'; ... |
---|
241 | '*.*', 'All Files (*.*)'}, ... |
---|
242 | 'Pick a file',oldfile); |
---|
243 | fileinput=[PathName FileName];%complete file name |
---|
244 | %testblank=findstr(fileinput,' ');%look for blanks |
---|
245 | % if ~isempty(testblank) |
---|
246 | % errordlg('forbidden input file name: contain blanks') |
---|
247 | % return |
---|
248 | % end |
---|
249 | sizf=size(fileinput); |
---|
250 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
251 | [path,name,ext]=fileparts(fileinput); |
---|
252 | SeriesData=[];%dfault |
---|
253 | if isequal(ext,'.xml') |
---|
254 | warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
255 | elseif isequal(ext,'.xls') |
---|
256 | warndlg_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
257 | else |
---|
258 | update_file(handles,fileinput,0) |
---|
259 | %update list of recent files in the menubar |
---|
260 | MenuFile_1=fileinput; |
---|
261 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
262 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
263 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
264 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
265 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
266 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
267 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
268 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
269 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
270 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
271 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
272 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
273 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
274 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
275 | dir_perso=prefdir; |
---|
276 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
277 | if exist(profil_perso,'file') |
---|
278 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
279 | else |
---|
280 | txt=ver('MATLAB'); |
---|
281 | Release=txt.Release; |
---|
282 | relnumb=str2num(Release(3:4)); |
---|
283 | if relnumb >= 14 |
---|
284 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
285 | else |
---|
286 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
287 | end |
---|
288 | end |
---|
289 | end |
---|
290 | |
---|
291 | |
---|
292 | % -------------------------------------------------------------------- |
---|
293 | function MenuFile_1_Callback(hObject, eventdata, handles) |
---|
294 | fileinput=get(handles.MenuFile_1,'Label'); |
---|
295 | update_file(handles,fileinput,0) |
---|
296 | |
---|
297 | % -------------------------------------------------------------------- |
---|
298 | function MenuFile_2_Callback(hObject, eventdata, handles) |
---|
299 | fileinput=get(handles.MenuFile_2,'Label'); |
---|
300 | update_file(handles,fileinput,0) |
---|
301 | |
---|
302 | % -------------------------------------------------------------------- |
---|
303 | function MenuFile_3_Callback(hObject, eventdata, handles) |
---|
304 | fileinput=get(handles.MenuFile_3,'Label'); |
---|
305 | update_file( handles,fileinput,0) |
---|
306 | |
---|
307 | % -------------------------------------------------------------------- |
---|
308 | function MenuFile_4_Callback(hObject, eventdata, handles) |
---|
309 | fileinput=get(handles.MenuFile_4,'Label'); |
---|
310 | update_file(handles,fileinput,0) |
---|
311 | |
---|
312 | % -------------------------------------------------------------------- |
---|
313 | function MenuFile_5_Callback(hObject, eventdata, handles) |
---|
314 | fileinput=get(handles.MenuFile_5,'Label'); |
---|
315 | update_file(handles,fileinput,0) |
---|
316 | |
---|
317 | % -------------------------------------------------------------------- |
---|
318 | function MenuBrowse_insert_Callback(hObject, eventdata, handles) |
---|
319 | |
---|
320 | RootPathCell=get(handles.RootPath,'String'); |
---|
321 | RootFileCell=get(handles.RootFile,'String'); |
---|
322 | oldfile=''; %default |
---|
323 | if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
324 | dir_perso=prefdir; |
---|
325 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
326 | if exist(profil_perso,'file') |
---|
327 | h=load (profil_perso); |
---|
328 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
329 | oldfile=h.filebase; |
---|
330 | end |
---|
331 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
332 | oldfile=h.RootPath; |
---|
333 | end |
---|
334 | end |
---|
335 | else |
---|
336 | oldfile=fullfile(RootPathCell{1},RootFileCell{1}); |
---|
337 | end |
---|
338 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
339 | {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; |
---|
340 | '*.xml', '.xml files '; ... |
---|
341 | '*.xls', '.xls files '; ... |
---|
342 | '*.png','.png image files'; ... |
---|
343 | '*.avi;*.AVI','.avi movie files'; ... |
---|
344 | '*.nc','.netcdf files'; ... |
---|
345 | '*.*', 'All Files (*.*)'}, ... |
---|
346 | 'Pick a file',oldfile); |
---|
347 | fileinput=[PathName FileName];%complete file name |
---|
348 | % testblank=findstr(fileinput,' ');%look for blanks |
---|
349 | % if ~isempty(testblank) |
---|
350 | % errordlg('forbidden input file name: contain blanks') |
---|
351 | % return |
---|
352 | % end |
---|
353 | sizf=size(fileinput); |
---|
354 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
355 | [path,name,ext]=fileparts(fileinput); |
---|
356 | SeriesData=[];%dfault |
---|
357 | if isequal(ext,'.xml') |
---|
358 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
359 | elseif isequal(ext,'.xls') |
---|
360 | msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
361 | else |
---|
362 | update_file(handles,fileinput,1) |
---|
363 | %update list of recent files in the menubar |
---|
364 | MenuFile_1=fileinput; |
---|
365 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
366 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
367 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
368 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
369 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
370 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
371 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
372 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
373 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
374 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
375 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
376 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
377 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
378 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
379 | dir_perso=prefdir; |
---|
380 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
381 | if exist(profil_perso,'file') |
---|
382 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
383 | else |
---|
384 | txt=ver('MATLAB'); |
---|
385 | Release=txt.Release; |
---|
386 | relnumb=str2num(Release(3:4)); |
---|
387 | if relnumb >= 14 |
---|
388 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
389 | else |
---|
390 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
391 | end |
---|
392 | end |
---|
393 | end |
---|
394 | %------------------------------------------------ |
---|
395 | |
---|
396 | % -------------------------------------------------------------------- |
---|
397 | function MenuFile_insert_1_Callback(hObject, eventdata, handles) |
---|
398 | fileinput=get(handles.MenuFile_insert_1,'Label'); |
---|
399 | update_file(handles,fileinput,1) |
---|
400 | |
---|
401 | % -------------------------------------------------------------------- |
---|
402 | function MenuFile_insert_2_Callback(hObject, eventdata, handles) |
---|
403 | fileinput=get(handles.MenuFile_insert_2,'Label'); |
---|
404 | update_file(handles,fileinput,1) |
---|
405 | |
---|
406 | % -------------------------------------------------------------------- |
---|
407 | function MenuFile_insert_3_Callback(hObject, eventdata, handles) |
---|
408 | fileinput=get(handles.MenuFile_insert_3,'Label'); |
---|
409 | update_file( handles,fileinput,1) |
---|
410 | |
---|
411 | % -------------------------------------------------------------------- |
---|
412 | function MenuFile_insert_4_Callback(hObject, eventdata, handles) |
---|
413 | fileinput=get(handles.MenuFile_insert_4,'Label'); |
---|
414 | update_file( handles,fileinput,1) |
---|
415 | |
---|
416 | % -------------------------------------------------------------------- |
---|
417 | function MenuFile_insert_5_Callback(hObject, eventdata, handles) |
---|
418 | fileinput=get(handles.MenuFile_insert_5,'Label'); |
---|
419 | update_file(handles,fileinput,1) |
---|
420 | |
---|
421 | %------------------------------------------------------------------------ |
---|
422 | % --- refresh the GUI data after introduction of a new file series |
---|
423 | % INPUT: |
---|
424 | % handles: |
---|
425 | % fileinput: name of the input file |
---|
426 | % addtest: =0 to refresh the list of file series, =1 to append a new series to the list (from the menu bar option 'Open_insert') |
---|
427 | function update_file(handles,fileinput,addtest) |
---|
428 | %------------------------------------------------------------------------ |
---|
429 | |
---|
430 | %% enable other menus and uicontrols |
---|
431 | set(handles.MenuOpen_insert,'Enable','on') |
---|
432 | set(handles.MenuFile_insert_1,'Enable','on') |
---|
433 | set(handles.MenuFile_insert_2,'Enable','on') |
---|
434 | set(handles.MenuFile_insert_3,'Enable','on') |
---|
435 | set(handles.MenuFile_insert_4,'Enable','on') |
---|
436 | set(handles.MenuFile_insert_5,'Enable','on') |
---|
437 | set(handles.RUN, 'Enable','On') |
---|
438 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red |
---|
439 | set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow |
---|
440 | drawnow |
---|
441 | |
---|
442 | %% get the input root name, indices, file extension and nomenclature NomType |
---|
443 | if ~exist(fileinput,'file') |
---|
444 | msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) |
---|
445 | return |
---|
446 | end |
---|
447 | [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); |
---|
448 | |
---|
449 | |
---|
450 | %% look for min and max indices existing in the file series and update NomType |
---|
451 | [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput); |
---|
452 | MinIndex_i=min(i1_series(i1_series>0)); |
---|
453 | if ~isempty(i2_series) |
---|
454 | MaxIndex_i=max(i2_series(i2_series>0)); |
---|
455 | else |
---|
456 | MaxIndex_i=max(i1_series(i1_series>0)); |
---|
457 | end |
---|
458 | MinIndex_j=min(j1_series(j1_series>0)); |
---|
459 | if ~isempty(j2_series) |
---|
460 | MaxIndex_j=max(j2_series(j2_series>0)); |
---|
461 | else |
---|
462 | MaxIndex_j=max(j1_series(j1_series>0)); |
---|
463 | end |
---|
464 | if addtest% case of insertion of a new series (menu bar option Open_insert) |
---|
465 | MinIndex_i_cell=[{num2str(MinIndex_i)} ;get(handles.num_MinIndex_i,'String')]; |
---|
466 | nb_field_cell=[{num2str(MaxIndex_i)} ;get(handles.num_MaxIndex_i,'String')]; |
---|
467 | MinIndex_j_cell=[{num2str(MinIndex_j)} ;get(handles.num_MinIndex_j,'String')]; |
---|
468 | nb_field2_cell=[{num2str(MaxIndex_j)} ;get(handles.num_MaxIndex_j,'String')]; |
---|
469 | else % refresh the list (menu bar option Open) |
---|
470 | MinIndex_i_cell={num2str(MinIndex_i)}; |
---|
471 | MinIndex_j_cell={num2str(MinIndex_j)}; |
---|
472 | nb_field_cell={num2str(MaxIndex_i)}; |
---|
473 | nb_field2_cell={num2str(MaxIndex_j)}; |
---|
474 | end |
---|
475 | set(handles.num_MinIndex_i,'String',MinIndex_i_cell); |
---|
476 | set(handles.num_MinIndex_j,'String',MinIndex_j_cell); |
---|
477 | set(handles.num_MaxIndex_i,'String',nb_field_cell); |
---|
478 | set(handles.num_MaxIndex_j,'String',nb_field2_cell); |
---|
479 | |
---|
480 | set(handles.waitbar_frame,'Units','pixels') |
---|
481 | pos=get(handles.waitbar_frame,'Position'); |
---|
482 | xima=0.5:pos(3)-0.5; |
---|
483 | yima=0.5:pos(4)-0.5; |
---|
484 | [XIma,YIma]=meshgrid(xima,yima); |
---|
485 | nb_i=size(i1_series,1); |
---|
486 | nb_j=size(i1_series,2); |
---|
487 | ind_i=(0.5:nb_i-0.5)*pos(3)/nb_i; |
---|
488 | ind_j=(0.5:nb_j-0.5)*pos(4)/nb_j; |
---|
489 | [Ind_i,Ind_j]=meshgrid(ind_i,ind_j); |
---|
490 | CData=zeros([size(XIma) 3]); |
---|
491 | file_ima=double((i1_series(:,:,1)>0)'); |
---|
492 | if size(file_ima,1)==1 |
---|
493 | file_ima=ones(pos(4),1)*file_ima; |
---|
494 | end |
---|
495 | CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); |
---|
496 | set(handles.waitbar_frame,'CData',CData) |
---|
497 | set(handles.waitbar_frame,'Units','normalized') |
---|
498 | % CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1; |
---|
499 | % set(hwaitbar,'CData',CData) |
---|
500 | %update_waitbar(handles.waitbar_frame,[],0) |
---|
501 | |
---|
502 | |
---|
503 | %% determine reference field indices |
---|
504 | ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV |
---|
505 | if ~isempty(i1) |
---|
506 | ref_i=i1; |
---|
507 | if ~isempty(i2) |
---|
508 | ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file |
---|
509 | % SeriesData.browse_Di=i2-i1; |
---|
510 | end |
---|
511 | end |
---|
512 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
513 | set(handles.num_first_i,'String',num2str(ref_i)); |
---|
514 | set(handles.num_last_i,'String',num2str(ref_i)); |
---|
515 | ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV |
---|
516 | if ~isempty(j1) |
---|
517 | ref_j=j1; |
---|
518 | if ~isempty(j2) |
---|
519 | ref_j=floor((j1+j2)/2); |
---|
520 | % SeriesData.browse_Dj=j2-j1; |
---|
521 | end |
---|
522 | end |
---|
523 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
524 | set(handles.num_first_j,'String',num2str(ref_j)) |
---|
525 | set(handles.num_last_j,'String',num2str(ref_j)); |
---|
526 | TimeUnit=''; %default |
---|
527 | time=[];%default |
---|
528 | |
---|
529 | % read timing and total frame number from the current file (movie files) !! may be overrid by xml file |
---|
530 | FileBase=fullfile(RootPath,RootFile); |
---|
531 | |
---|
532 | testima=0; %test for image input |
---|
533 | if isequal(lower(FileExt),'.avi') %.avi file |
---|
534 | testima=1; |
---|
535 | % info=aviinfo([FileBase FileExt]); |
---|
536 | % time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)'; |
---|
537 | % num_MaxIndex_i=info.NumFrames; |
---|
538 | % num_MaxIndex_j=1; |
---|
539 | elseif ~isempty(imformats(FileExt(2:end))) |
---|
540 | testima=1; |
---|
541 | % if isequal(NomType,'*')% multi-frame image |
---|
542 | % imainfo=imfinfo([FileBase FileExt]); |
---|
543 | % if length(imainfo) >1 %case of image with multiple frames |
---|
544 | % num_MaxIndex_i=length(imainfo); |
---|
545 | % num_MaxIndex_j=1; |
---|
546 | % end |
---|
547 | % end |
---|
548 | elseif isequal(FileExt,'.vol') |
---|
549 | testima=1; |
---|
550 | end |
---|
551 | |
---|
552 | %% fill the list of file series |
---|
553 | % select the first line in the list |
---|
554 | set(handles.RootPath,'Value',1) |
---|
555 | set(handles.SubDir,'Value',1) |
---|
556 | set(handles.RootFile,'Value',1) |
---|
557 | set(handles.NomType,'Value',1) |
---|
558 | set(handles.FileExt,'Value',1) |
---|
559 | set(handles.num_MaxIndex_i,'Value',1) |
---|
560 | set(handles.num_MaxIndex_j,'Value',1) |
---|
561 | |
---|
562 | % insert the current file series at the head of the list |
---|
563 | if addtest |
---|
564 | SeriesData=get(handles.series,'UserData'); |
---|
565 | % SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; |
---|
566 | SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; |
---|
567 | SeriesData.i1_series=[SeriesData.i1_series;{i1_series}]; |
---|
568 | SeriesData.i2_series=[SeriesData.i2_series;{i2_series}]; |
---|
569 | SeriesData.j1_series=[SeriesData.j1_series;{j1_series}]; |
---|
570 | SeriesData.j2_series=[SeriesData.j2_series;{j2_series}]; |
---|
571 | RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ; |
---|
572 | SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; |
---|
573 | RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; |
---|
574 | NomTypeCell=[{NomType}; SeriesData.NomType]; |
---|
575 | FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; |
---|
576 | FileTypeCell=[{FileType};SeriesData.FileType]; |
---|
577 | set(handles.NomType,'String',[{};get(handles.NomType,'String')]) |
---|
578 | |
---|
579 | % or re-initialise the list of input file series |
---|
580 | else |
---|
581 | SeriesData=[];%re-initialisation |
---|
582 | % SeriesData.displ_num=[0 0 0 0]; |
---|
583 | SeriesData.i1_series={i1_series}; |
---|
584 | SeriesData.i2_series={i2_series}; |
---|
585 | SeriesData.j1_series={j1_series}; |
---|
586 | SeriesData.j2_series={j2_series}; |
---|
587 | RootPathCell={RootPath}; |
---|
588 | SubDirCell={SubDir}; |
---|
589 | RootFileCell={RootFile}; |
---|
590 | NomTypeCell={NomType}; |
---|
591 | FileExtCell={FileExt}; |
---|
592 | FileTypeCell={FileType}; |
---|
593 | end |
---|
594 | SeriesData.NomType=NomTypeCell; |
---|
595 | SeriesData.FileType=FileTypeCell; |
---|
596 | SeriesData.CurrentInputFile=fileinput; |
---|
597 | set(handles.RootPath,'String',RootPathCell); |
---|
598 | set(handles.SubDir,'String',SubDirCell); |
---|
599 | set(handles.RootFile,'String',RootFileCell); |
---|
600 | set(handles.NomType,'String',NomTypeCell); |
---|
601 | set(handles.FileExt,'String',FileExtCell); |
---|
602 | |
---|
603 | %% enable field and veltype menus |
---|
604 | testfield=isequal(get(handles.FieldMenu,'enable'),'on'); |
---|
605 | testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); |
---|
606 | testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); |
---|
607 | testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); |
---|
608 | testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); |
---|
609 | testnc=0; |
---|
610 | testnc_1=0; |
---|
611 | testcivx=0; |
---|
612 | testcivx_1=0; |
---|
613 | if length(FileExtCell)==1 || length(FileExtCell)>2 |
---|
614 | for iview=1:length(FileExtCell) |
---|
615 | if isequal(FileExtCell{iview},'.nc') |
---|
616 | testnc=1; |
---|
617 | end |
---|
618 | if isequal(FileTypeCell{iview},'civx') |
---|
619 | testcivx=1; |
---|
620 | end |
---|
621 | end |
---|
622 | elseif length(FileExtCell)==2 |
---|
623 | testnc=isequal(FileExtCell{1},'.nc'); |
---|
624 | testnc_1=isequal(FileExtCell{2},'.nc'); |
---|
625 | testcivx=isequal(FileTypeCell{1},'civx'); |
---|
626 | testcivx_1=isequal(FileTypeCell{2},'civx'); |
---|
627 | end |
---|
628 | if testfield && testnc |
---|
629 | view_FieldMenu(handles,'on') |
---|
630 | if testcivx |
---|
631 | menustr=get(handles.FieldMenu,'String'); |
---|
632 | if isequal(menustr,{'get_field...'}) |
---|
633 | set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
634 | end |
---|
635 | else |
---|
636 | set(handles.FieldMenu,'Value',1) |
---|
637 | set(handles.FieldMenu,'String',{'get_field...'}) |
---|
638 | end |
---|
639 | else |
---|
640 | view_FieldMenu(handles,'off') |
---|
641 | end |
---|
642 | if testfield_1 && testnc_1 |
---|
643 | view_FieldMenu_1(handles,'on') |
---|
644 | if testcivx_1 |
---|
645 | menustr=get(handles.FieldMenu_1,'String'); |
---|
646 | if isequal(menustr,{'get_field...'}) |
---|
647 | set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
648 | end |
---|
649 | else |
---|
650 | set(handles.FieldMenu_1,'Value',1) |
---|
651 | set(handles.FieldMenu_1,'String',{'get_field...'}) |
---|
652 | end |
---|
653 | else |
---|
654 | view_FieldMenu_1(handles,'off') |
---|
655 | end |
---|
656 | if testveltype && testcivx |
---|
657 | set(handles.VelTypeMenu,'Visible','on') |
---|
658 | set(handles.VelType_text,'Visible','on'); |
---|
659 | else |
---|
660 | set(handles.VelTypeMenu,'Visible','off') |
---|
661 | set(handles.VelType_text,'Visible','off'); |
---|
662 | end |
---|
663 | if testveltype_1 && testcivx_1 |
---|
664 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
665 | set(handles.VelType_text_1,'Visible','on'); |
---|
666 | else |
---|
667 | set(handles.VelTypeMenu_1,'Visible','off') |
---|
668 | set(handles.VelType_text_1,'Visible','off'); |
---|
669 | end |
---|
670 | if testtransform && (testcivx || testima) |
---|
671 | set(handles.FieldTransform,'Visible','on') |
---|
672 | % view_TRANSFORM(handles,'on') |
---|
673 | else |
---|
674 | set(handles.FieldTransform,'Visible','off') |
---|
675 | % view_TRANSFORM(handles,'off') |
---|
676 | end |
---|
677 | if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima |
---|
678 | msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) |
---|
679 | return |
---|
680 | end |
---|
681 | |
---|
682 | %% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
683 | ext_imadoc=''; |
---|
684 | if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') |
---|
685 | ext_imadoc=FileExt; |
---|
686 | elseif exist([FileBase '.xml'],'file') |
---|
687 | ext_imadoc='.xml'; |
---|
688 | elseif exist([FileBase '.civ'],'file') |
---|
689 | ext_imadoc='.civ'; |
---|
690 | end |
---|
691 | %read the ImaDoc file |
---|
692 | XmlData=[]; |
---|
693 | NbSlice_calib={}; |
---|
694 | if isequal(ext_imadoc,'.xml') |
---|
695 | [XmlData,warntext]=imadoc2struct([FileBase '.xml']); |
---|
696 | if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') && ischar(XmlData.Heading.ImageName) |
---|
697 | [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); |
---|
698 | end |
---|
699 | if isfield(XmlData,'Time') |
---|
700 | time=XmlData.Time; |
---|
701 | end |
---|
702 | if isfield(XmlData,'Camera') |
---|
703 | if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) |
---|
704 | NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform |
---|
705 | if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) |
---|
706 | msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); |
---|
707 | end |
---|
708 | end |
---|
709 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) |
---|
710 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
711 | end |
---|
712 | end |
---|
713 | if ~isempty(warntext) |
---|
714 | msgbox_uvmat('WARNING',warntext) |
---|
715 | end |
---|
716 | elseif isequal(ext_imadoc,'.civ') |
---|
717 | [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); |
---|
718 | time=XmlData.Time; |
---|
719 | if error==2, warntext=['no file ' FileBase '.civ']; |
---|
720 | elseif error==1, warntext='inconsistent number of fields in the .civ file'; |
---|
721 | end |
---|
722 | end |
---|
723 | |
---|
724 | %% display times |
---|
725 | if addtest |
---|
726 | SeriesData.Time=[{time} SeriesData.Time]; |
---|
727 | else |
---|
728 | SeriesData.Time={time}; |
---|
729 | end |
---|
730 | set(handles.TimeUnit,'String',TimeUnit) |
---|
731 | set(handles.series,'UserData',SeriesData); |
---|
732 | |
---|
733 | %% number of slices |
---|
734 | if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') |
---|
735 | siz=size(XmlData.GeometryCalib.SliceCoord); |
---|
736 | if siz(1)>1 |
---|
737 | NbSlice=siz(1); |
---|
738 | else |
---|
739 | NbSlice=1; |
---|
740 | end |
---|
741 | set(handles.num_NbSlice,'String',num2str(NbSlice)) |
---|
742 | end |
---|
743 | |
---|
744 | % set menus of index pairs |
---|
745 | NomType_Callback([], [], handles) |
---|
746 | |
---|
747 | %store the root name for future opening of uvmat |
---|
748 | dir_perso=prefdir; |
---|
749 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
750 | if exist(profil_perso,'file') |
---|
751 | save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat |
---|
752 | else |
---|
753 | txt=ver('MATLAB'); |
---|
754 | Release=txt.Release; |
---|
755 | relnumb=str2num(Release(3:4)); |
---|
756 | if relnumb >= 14 |
---|
757 | save (profil_perso,'RootPath','SubDir','RootFile','NomType','-V6') %store the root name for future opening of uvmat |
---|
758 | else |
---|
759 | save(profil_perso,'RootPath','SubDir','RootFile','NomType') |
---|
760 | end |
---|
761 | end |
---|
762 | set(handles.RootPath,'BackgroundColor',[1 1 1]) |
---|
763 | % set(handles.PathCampaign,'String',SeriesData.PathCampaign) |
---|
764 | num_last_j_Callback([], [], handles) |
---|
765 | num_last_i_Callback([], [], handles) |
---|
766 | |
---|
767 | %------------------------------------------------------------------------ |
---|
768 | function RootPath_Callback(hObject, eventdata, handles) |
---|
769 | %------------------------------------------------------------------------ |
---|
770 | Val=get(handles.RootPath,'Value'); |
---|
771 | synchronise_view(handles,Val) |
---|
772 | NomType_Callback(hObject, eventdata, handles) |
---|
773 | |
---|
774 | %------------------------------------------------------------------------ |
---|
775 | function synchronise_view(handles,Val) |
---|
776 | %------------------------------------------------------------------------ |
---|
777 | set(handles.RootPath,'Value',Val) |
---|
778 | set(handles.SubDir,'Value',Val) |
---|
779 | set(handles.RootFile,'Value',Val) |
---|
780 | set(handles.NomType,'Value',Val) |
---|
781 | set(handles.FileExt,'Value',Val) |
---|
782 | set(handles.num_MaxIndex_i,'Value',Val) |
---|
783 | set(handles.num_MaxIndex_j,'Value',Val) |
---|
784 | set(handles.time_first,'Value',Val) |
---|
785 | set(handles.time_last,'Value',Val) |
---|
786 | |
---|
787 | |
---|
788 | %------------------------------------------------------------------------ |
---|
789 | % Executes on carriage return on the subdir civ1 edit window |
---|
790 | function SubDir_Callback(hObject, eventdata, handles) |
---|
791 | %------------------------------------------------------------------------ |
---|
792 | Val=get(handles.SubDir,'Value'); |
---|
793 | synchronise_view(handles,Val) |
---|
794 | NomType_Callback(hObject, eventdata, handles) |
---|
795 | |
---|
796 | %------------------------------------------------------------------------ |
---|
797 | % --- function activated when a new filebase (image series) is introduced |
---|
798 | function RootFile_Callback(hObject, eventdata, handles) |
---|
799 | %------------------------------------------------------------------------ |
---|
800 | Val=get(handles.RootFile,'Value'); |
---|
801 | synchronise_view(handles,Val) |
---|
802 | NomType_Callback(hObject, eventdata, handles) |
---|
803 | |
---|
804 | %-------------------------------------------------------------- |
---|
805 | %function activated when a new filebase (image series) is introduced |
---|
806 | %------------------------------------------------------------ |
---|
807 | function FileExt_Callback(hObject, eventdata, handles) |
---|
808 | Val=get(handles.FileExt,'Value'); |
---|
809 | synchronise_view(handles,Val) |
---|
810 | |
---|
811 | %-------------------------------------------------------------- |
---|
812 | %function activated when a new filebase (image series) is introduced |
---|
813 | %------------------------------------------------------------ |
---|
814 | function num_MaxIndex_i_Callback(hObject, eventdata, handles) |
---|
815 | Val=get(handles.num_MaxIndex_i,'Value'); |
---|
816 | synchronise_view(handles,Val) |
---|
817 | |
---|
818 | %-------------------------------------------------------------- |
---|
819 | %function activated when a new filebase (image series) is introduced |
---|
820 | %------------------------------------------------------------ |
---|
821 | function num_MaxIndex_j_Callback(hObject, eventdata, handles) |
---|
822 | Val=get(handles.num_MaxIndex_j,'Value'); |
---|
823 | synchronise_view(handles,Val) |
---|
824 | |
---|
825 | %-------------------------------------------------------------- |
---|
826 | %function activated when a new filebase (image series) is introduced |
---|
827 | %------------------------------------------------------------ |
---|
828 | function time_first_Callback(hObject, eventdata, handles) |
---|
829 | Val=get(handles.time_first,'Value'); |
---|
830 | synchronise_view(handles,Val) |
---|
831 | |
---|
832 | %-------------------------------------------------------------- |
---|
833 | %function activated when a new filebase (image series) is introduced |
---|
834 | %------------------------------------------------------------ |
---|
835 | function time_last_Callback(hObject, eventdata, handles) |
---|
836 | Val=get(handles.time_last,'Value'); |
---|
837 | synchronise_view(handles,Val) |
---|
838 | NomType_Callback(hObject, eventdata, handles) |
---|
839 | |
---|
840 | %------------------------------------------------------------------------ |
---|
841 | function NomType_Callback(hObject, eventdata, handles) |
---|
842 | %------------------------------------------------------------------------ |
---|
843 | |
---|
844 | SeriesData=get(handles.series,'UserData'); |
---|
845 | if isfield(SeriesData,'NomType') |
---|
846 | NomTypeCell=SeriesData.NomType; |
---|
847 | else |
---|
848 | NomTypeCell={}; |
---|
849 | end |
---|
850 | nbfield2_cell=get(handles.num_MaxIndex_j,'String'); |
---|
851 | val=get(handles.num_MaxIndex_j,'Value'); |
---|
852 | if iscell(nbfield2_cell) |
---|
853 | nbfield2=str2num(nbfield2_cell{val}); |
---|
854 | else |
---|
855 | nbfield2=str2num(nbfield2_cell); |
---|
856 | end |
---|
857 | nbfield_cell=get(handles.num_MaxIndex_i,'String'); |
---|
858 | if iscell(nbfield_cell) |
---|
859 | nbfield=str2num(nbfield_cell{val}); |
---|
860 | else |
---|
861 | nbfield=str2num(nbfield_cell); |
---|
862 | end |
---|
863 | |
---|
864 | % set(handles.mode,'Visible','off') % do not show index pairs by default |
---|
865 | set(handles.Pairs,'Visible','off') |
---|
866 | % set(handles.ref_i,'Visible','off') |
---|
867 | % set(handles.ref_i_text,'Visible','off') |
---|
868 | testpair=0; |
---|
869 | %set the menus of image pairs and default selection for series |
---|
870 | %list pairs if relevant |
---|
871 | Val=get(handles.NomType,'Value'); |
---|
872 | synchronise_view(handles,Val) |
---|
873 | if ~isfield(SeriesData,'j1_series')||isempty(SeriesData.j1_series{Val}) |
---|
874 | state_j='off'; %no need for j index |
---|
875 | else |
---|
876 | state_j='on'; %case of j index |
---|
877 | end |
---|
878 | % show index pairs if files exist |
---|
879 | if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val})) |
---|
880 | testpair=1; |
---|
881 | if ~isempty(SeriesData.i2_series{Val}) %pairs with i index |
---|
882 | set(handles.mode,'Value',1) |
---|
883 | set(handles.mode,'String',{'series(Di)'}) |
---|
884 | else %pairs with j index |
---|
885 | set(handles.mode,'Value',1) |
---|
886 | set(handles.mode,'String',{'bursts';'series(Dj)'}) |
---|
887 | if nbfield2>10 || nbfield==1 |
---|
888 | set(handles.mode,'Value',2); |
---|
889 | else |
---|
890 | set(handles.mode,'Value',1); |
---|
891 | end |
---|
892 | end |
---|
893 | set(handles.mode,'Visible','on') |
---|
894 | else |
---|
895 | set(handles.mode,'Visible','off') |
---|
896 | end |
---|
897 | % if ~isempty(NomTypeCell) |
---|
898 | % NomType=NomTypeCell{Val}; |
---|
899 | % switch NomType |
---|
900 | % case {'_1-2_1', '_1-2'} |
---|
901 | % set(handles.mode,'String',{'series(Di)'}) |
---|
902 | % set(handles.mode,'Value',1); |
---|
903 | % set(handles.mode,'Visible','on') |
---|
904 | % testpair=1; |
---|
905 | % case {'#_ab'} |
---|
906 | % set(handles.mode,'String',{'bursts'}) |
---|
907 | % set(handles.mode,'Value',1); |
---|
908 | % testpair=1; |
---|
909 | % case '_1_1-2' |
---|
910 | % set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice |
---|
911 | % if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1)) |
---|
912 | % set(handles.mode,'Value',2); |
---|
913 | % else |
---|
914 | % set(handles.mode,'Value',1);% advice 'bursts' for small bursts |
---|
915 | % end |
---|
916 | % set(handles.mode,'Visible','on') |
---|
917 | % testpair=1; |
---|
918 | % end |
---|
919 | % switch NomType |
---|
920 | % case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices |
---|
921 | % state_j='on'; |
---|
922 | % end |
---|
923 | % end |
---|
924 | if testpair |
---|
925 | mode_Callback(hObject, eventdata, handles) |
---|
926 | else |
---|
927 | set(handles.NomType,'String',NomTypeCell) |
---|
928 | set(handles.j_txt,'Visible',state_j) |
---|
929 | set(handles.num_MinIndex_j,'Visible',state_j) |
---|
930 | set(handles.num_first_j,'Visible',state_j) |
---|
931 | set(handles.num_incr_j,'Visible',state_j) |
---|
932 | set(handles.num_last_j,'Visible',state_j) |
---|
933 | set(handles.num_MaxIndex_j,'Visible',state_j) |
---|
934 | end |
---|
935 | |
---|
936 | |
---|
937 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? |
---|
938 | % --- Executes on button press in mode. |
---|
939 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
940 | function mode_Callback(hObject, eventdata, handles) |
---|
941 | |
---|
942 | SeriesData=get(handles.series,'UserData'); |
---|
943 | mode_list=get(handles.mode,'String'); |
---|
944 | mode_value=get(handles.mode,'Value'); |
---|
945 | mode=mode_list{mode_value}; |
---|
946 | NomType=[]; |
---|
947 | % test_find_pair=0; |
---|
948 | % if isfield(SeriesData,'NomType') |
---|
949 | NomTypeCell=SeriesData.NomType; |
---|
950 | Val=get(handles.NomType,'Value'); |
---|
951 | NomType=NomTypeCell{Val}; |
---|
952 | check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); |
---|
953 | |
---|
954 | time=[]; |
---|
955 | if isfield(SeriesData,'Time') |
---|
956 | time=SeriesData.Time{1}; %get the set of times |
---|
957 | end |
---|
958 | siztime=size(time); |
---|
959 | nbfield=siztime(1); |
---|
960 | nbfield2=siztime(2); |
---|
961 | % indchosen=1; %%first pair selected by default |
---|
962 | if isequal(mode,'bursts') |
---|
963 | enable_i(handles,'On') |
---|
964 | enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) |
---|
965 | elseif ~isempty(SeriesData.j2_series{Val}) |
---|
966 | enable_i(handles,'On') |
---|
967 | enable_j(handles,'On') % allow both i and j index scanning |
---|
968 | else |
---|
969 | enable_i(handles,'On') |
---|
970 | enable_j(handles,'Off') |
---|
971 | end |
---|
972 | % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 |
---|
973 | set(handles.series,'UserData',SeriesData) |
---|
974 | |
---|
975 | %list pairs if relevant |
---|
976 | if check_pairs |
---|
977 | find_netcpair_civ(handles,Val) |
---|
978 | end |
---|
979 | |
---|
980 | %------------------------------------- |
---|
981 | function enable_i(handles,state) |
---|
982 | set(handles.i_txt,'Visible',state) |
---|
983 | set(handles.num_first_i,'Visible',state) |
---|
984 | set(handles.num_last_i,'Visible',state) |
---|
985 | set(handles.num_incr_i,'Visible',state) |
---|
986 | set(handles.num_MaxIndex_i,'Visible',state) |
---|
987 | set(handles.ref_i,'Visible',state) |
---|
988 | set(handles.ref_i_text,'Visible',state) |
---|
989 | |
---|
990 | %----------------------------------- |
---|
991 | function enable_j(handles,state) |
---|
992 | set(handles.j_txt,'Visible',state) |
---|
993 | set(handles.num_MinIndex_j,'Visible',state) |
---|
994 | set(handles.num_first_j,'Visible',state) |
---|
995 | set(handles.num_last_j,'Visible',state) |
---|
996 | set(handles.num_incr_j,'Visible',state) |
---|
997 | set(handles.num_MaxIndex_j,'Visible',state) |
---|
998 | set(handles.ref_j,'Visible',state) |
---|
999 | set(handles.ref_j_text,'Visible',state) |
---|
1000 | |
---|
1001 | %----------------------------------- |
---|
1002 | function view_FieldMenu(handles,state) |
---|
1003 | set(handles.FieldMenu,'Visible',state) |
---|
1004 | set(handles.Field_text,'Visible',state) |
---|
1005 | set(handles.Field_frame,'Visible',state) |
---|
1006 | |
---|
1007 | %----------------------------------- |
---|
1008 | function view_FieldMenu_1(handles,state) |
---|
1009 | set(handles.FieldMenu_1,'Visible',state) |
---|
1010 | set(handles.Field_text_1,'Visible',state) |
---|
1011 | |
---|
1012 | % %----------------------------------- |
---|
1013 | % function view_TRANSFORM(handles,state) |
---|
1014 | % set(handles.TRANSFORM_frame,'Visible',state) |
---|
1015 | % set(handles.transform_fct,'Visible',state); |
---|
1016 | % set(handles.TRANSFORM_title,'Visible',state) |
---|
1017 | |
---|
1018 | %-------------------------------------------------------------- |
---|
1019 | % determine the menu for civ1 pairs depending on existing netcdf files |
---|
1020 | % with the reference indices ref_i and ref_j |
---|
1021 | %---------------------------------------------------------------- |
---|
1022 | function find_netcpair_civ(handles,Val) |
---|
1023 | SeriesData=get(handles.series,'UserData'); |
---|
1024 | % NomTypeCell=get(handles.NomType,'String'); |
---|
1025 | NomTypeCell=SeriesData.NomType; |
---|
1026 | NomType=NomTypeCell{Val}; |
---|
1027 | |
---|
1028 | set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible |
---|
1029 | %nomenclature types |
---|
1030 | RootPathCell=get(handles.RootPath,'String'); |
---|
1031 | filepath=RootPathCell{Val}; |
---|
1032 | RootFileCell=get(handles.RootFile,'String'); |
---|
1033 | filename=RootFileCell{Val}; |
---|
1034 | filebase=fullfile(filepath,filename); |
---|
1035 | SubDirCell=get(handles.SubDir,'String'); |
---|
1036 | subdir=SubDirCell{Val}; |
---|
1037 | if ~exist(fullfile(filepath,subdir),'dir') |
---|
1038 | msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist']) |
---|
1039 | set(handles.list_pair_civ,'String',{''}); |
---|
1040 | return |
---|
1041 | end |
---|
1042 | mode_list=get(handles.mode,'String'); |
---|
1043 | mode_value=get(handles.mode,'Value'); |
---|
1044 | mode=mode_list{mode_value}; |
---|
1045 | |
---|
1046 | %reads image numbers from the interface |
---|
1047 | % ref_i=str2num(get(handles.ref_i,'String')); |
---|
1048 | % ref_j=str2num(get(handles.ref_j,'String')); |
---|
1049 | % ref_time=0; |
---|
1050 | % nbfield=50; |
---|
1051 | % nbfield2=50;%default max number of pairs |
---|
1052 | |
---|
1053 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
1054 | % be performed, while the result is needed for next steps. |
---|
1055 | |
---|
1056 | % ind_exist=0; |
---|
1057 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
1058 | if length(TimeUnit)>=1 |
---|
1059 | dtunit=['m' TimeUnit]; |
---|
1060 | else |
---|
1061 | dtunit='e-03'; |
---|
1062 | end |
---|
1063 | |
---|
1064 | %% NEW |
---|
1065 | i1_series=SeriesData.i1_series{Val}; |
---|
1066 | i2_series=SeriesData.i2_series{Val}; |
---|
1067 | j1_series=SeriesData.j1_series{Val}; |
---|
1068 | j2_series=SeriesData.j2_series{Val}; |
---|
1069 | displ_pair={}; |
---|
1070 | if strcmp(mode,'series(Di)') |
---|
1071 | if isempty(i2_series) |
---|
1072 | msgbox_uvmat('ERROR','no i1-i2 pair available') |
---|
1073 | return |
---|
1074 | end |
---|
1075 | diff_i=i2_series-i1_series; |
---|
1076 | min_diff=min(diff_i(diff_i>0)); |
---|
1077 | max_diff=max(diff_i(diff_i>0)); |
---|
1078 | for ipair=min_diff:max_diff |
---|
1079 | if numel(diff_i(diff_i==ipair))>0 |
---|
1080 | displ_pair=[displ_pair;{['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; |
---|
1081 | end |
---|
1082 | end |
---|
1083 | if ~isempty(displ_pair) |
---|
1084 | displ_pair=[displ_pair;{'Di=*|*'}]; |
---|
1085 | end |
---|
1086 | elseif strcmp(mode,'series(Dj)') |
---|
1087 | if isempty(j2_series) |
---|
1088 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
1089 | return |
---|
1090 | end |
---|
1091 | diff_j=j2_series-j1_series; |
---|
1092 | min_diff=min(diff_j(diff_j>0)); |
---|
1093 | max_diff=max(diff_j(diff_j>0)); |
---|
1094 | for ipair=min_diff:max_diff |
---|
1095 | if numel(diff_j(diff_j==ipair))>0 |
---|
1096 | displ_pair=[displ_pair;{['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]}]; |
---|
1097 | end |
---|
1098 | end |
---|
1099 | if ~isempty(displ_pair) |
---|
1100 | displ_pair=[displ_pair;{'Dj=*|*'}]; |
---|
1101 | end |
---|
1102 | elseif strcmp(mode,'bursts') |
---|
1103 | if isempty(j2_series) |
---|
1104 | msgbox_uvmat('ERROR','no j1-j2 pair available') |
---|
1105 | return |
---|
1106 | end |
---|
1107 | diff_j=j2_series-j1_series; |
---|
1108 | min_j1=min(j1_series(j1_series>0)); |
---|
1109 | max_j1=max(j1_series(j1_series>0)); |
---|
1110 | min_j2=min(j2_series(j2_series>0)); |
---|
1111 | max_j2=max(j2_series(j2_series>0)); |
---|
1112 | for pair1=min_j1:min(max_j1,min_j1+20) |
---|
1113 | for pair2=min_j2:min(max_j2,min_j2+20) |
---|
1114 | if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0 |
---|
1115 | displ_pair=[displ_pair;{['j= ' num2str(pair1) '-' num2str(pair2)]}]; |
---|
1116 | end |
---|
1117 | end |
---|
1118 | end |
---|
1119 | if ~isempty(displ_pair) |
---|
1120 | displ_pair=[displ_pair;{'j=*-*'}]; |
---|
1121 | end |
---|
1122 | end |
---|
1123 | |
---|
1124 | %% display list of pairs |
---|
1125 | displ_pair_list=get(handles.list_pair_civ,'String'); |
---|
1126 | NewVal=[]; |
---|
1127 | if ~isempty(displ_pair_list) |
---|
1128 | Val=get(handles.list_pair_civ,'Value'); |
---|
1129 | NewVal=find(strcmp(displ_pair_list{Val},displ_pair),1);% look at the previous display in the new menu displ_pâir |
---|
1130 | end |
---|
1131 | if ~isempty(NewVal) |
---|
1132 | set(handles.list_pair_civ,'Value',NewVal) |
---|
1133 | else |
---|
1134 | set(handles.list_pair_civ,'Value',1) |
---|
1135 | end |
---|
1136 | set(handles.list_pair_civ,'String',displ_pair) |
---|
1137 | displ_pair |
---|
1138 | |
---|
1139 | % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
1140 | % if strcmp(mode,'series(Di)') |
---|
1141 | % for index=1:min(nbfield-1,50) |
---|
1142 | % filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir); |
---|
1143 | % select=(exist(filename,'file')==2); |
---|
1144 | % if select==1 |
---|
1145 | % ind_exist=ind_exist+1; |
---|
1146 | % displ_num(1,ind_exist)=0; |
---|
1147 | % displ_num(2,ind_exist)=0; |
---|
1148 | % displ_num(3,ind_exist)=-floor(index/2); |
---|
1149 | % displ_num(4,ind_exist)=ceil(index/2); |
---|
1150 | % %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); |
---|
1151 | % [Cte,var_detect,ichoice]=nc2struct(filename,{}); |
---|
1152 | % if isfield(Cte,'dt2') |
---|
1153 | % dt=Cte.dt2; |
---|
1154 | % elseif isfield(Cte,'dt') |
---|
1155 | % dt=Cte.dt; |
---|
1156 | % end |
---|
1157 | % if isfield(Cte,'absolut_time_TO_2') |
---|
1158 | % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
1159 | % elseif isfield(Cte,'absolut_time_TO') |
---|
1160 | % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
1161 | % elseif isfield(Cte,'Time') |
---|
1162 | % ref_time(ind_exist)=Cte.Time; |
---|
1163 | % end |
---|
1164 | % displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
1165 | % end |
---|
1166 | % end |
---|
1167 | % set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]); |
---|
1168 | % elseif isequal(mode,'series(Dj)')% series on the j index |
---|
1169 | % for index=1:min(nbfield2-1,50) |
---|
1170 | % filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir); |
---|
1171 | % select=(exist(filename,'file')==2); |
---|
1172 | % if select==1 |
---|
1173 | % ind_exist=ind_exist+1; |
---|
1174 | % displ_num(1,ind_exist)=-floor(index/2); |
---|
1175 | % displ_num(2,ind_exist)=ceil(index/2); |
---|
1176 | % displ_num(3,ind_exist)=0; |
---|
1177 | % displ_num(4,ind_exist)=0; |
---|
1178 | % [Cte,var_detect,ichoice]=nc2struct(filename,{}); |
---|
1179 | % if isfield(Cte,'dt2') |
---|
1180 | % dt=Cte.dt2; |
---|
1181 | % elseif isfield(Cte,'dt') |
---|
1182 | % dt=Cte.dt; |
---|
1183 | % end |
---|
1184 | % if isfield(Cte,'absolut_time_TO_2') |
---|
1185 | % ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
1186 | % elseif isfield(Cte,'absolut_time_TO') |
---|
1187 | % ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
1188 | % elseif isfield(Cte,'Time') |
---|
1189 | % ref_time(ind_exist)=Cte.Time; |
---|
1190 | % end |
---|
1191 | % displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
1192 | % end |
---|
1193 | % end |
---|
1194 | % set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]); |
---|
1195 | % elseif isequal(mode,'bursts') %case of bursts |
---|
1196 | % for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode |
---|
1197 | % for numod_b=(numod_a+1):nbfield2 |
---|
1198 | % [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir) |
---|
1199 | % select=(exist(filename,'file')==2) |
---|
1200 | % if select==1 |
---|
1201 | % ind_exist=ind_exist+1; |
---|
1202 | % numlist_a(ind_exist)=numod_a; |
---|
1203 | % numlist_b(ind_exist)=numod_b; |
---|
1204 | % Attr=nc2struct(filename,[]); |
---|
1205 | % isfield(Attr,'absolut_time_T0_2') |
---|
1206 | % if isfield(Attr,'dt2') |
---|
1207 | % dt(ind_exist)=Attr.dt2; |
---|
1208 | % ref_time(ind_exist)=Attr.absolut_time_T0_2; |
---|
1209 | % elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0') |
---|
1210 | % dt(ind_exist)=Attr.dt; |
---|
1211 | % ref_time(ind_exist)=Attr.absolut_time_T0; |
---|
1212 | % else |
---|
1213 | % dt(ind_exist)=NaN;%no information on dt |
---|
1214 | % end |
---|
1215 | % %determine nom_type_ima for pair display (used in num2stra.m) |
---|
1216 | % switch NomType |
---|
1217 | % case {'#ab'} |
---|
1218 | % nom_type_ima='#a'; |
---|
1219 | % case {'#AB'} |
---|
1220 | % nom_type_ima='#A'; |
---|
1221 | % otherwise |
---|
1222 | % nom_type_ima='_1_1'; |
---|
1223 | % end |
---|
1224 | % displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ... |
---|
1225 | % ' :dt= ' num2str(dt(ind_exist)*1000)]; |
---|
1226 | % end |
---|
1227 | % end |
---|
1228 | % set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]); |
---|
1229 | % end |
---|
1230 | % if exist('dt','var') & ~isempty(dt) |
---|
1231 | % [dtsort,indsort]=sort(dt); |
---|
1232 | % displ_num(1,:)=numlist_a(indsort); |
---|
1233 | % displ_num(2,:)=numlist_b(indsort); |
---|
1234 | % displ_num(3,:)=0; |
---|
1235 | % displ_num(4,:)=0; |
---|
1236 | % displ_pair=displ_pair(indsort); |
---|
1237 | % ref_time=ref_time(indsort); |
---|
1238 | % end |
---|
1239 | % end |
---|
1240 | if isempty(displ_pair) |
---|
1241 | msgbox_uvmat('ERROR',['no file available for the selected subdirectory ' subdir]) |
---|
1242 | end |
---|
1243 | return |
---|
1244 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END FUNCTION |
---|
1245 | |
---|
1246 | |
---|
1247 | if ind_exist==0 |
---|
1248 | if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
1249 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir]) |
---|
1250 | else |
---|
1251 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir]) |
---|
1252 | end |
---|
1253 | if isequal(mode,'bursts') %case of bursts |
---|
1254 | set(handles.list_pair_civ,'String',{'j=*-*'}); |
---|
1255 | elseif isequal(mode,'series(Di)') %case of bursts |
---|
1256 | set(handles.list_pair_civ,'String',{'Di=*|*'}); |
---|
1257 | elseif isequal(mode,'series(Dj)') %case of bursts |
---|
1258 | set(handles.list_pair_civ,'String',{'Dj=*|*'}); |
---|
1259 | end |
---|
1260 | end |
---|
1261 | return |
---|
1262 | %TO update |
---|
1263 | val=get(handles.list_pair_civ,'Value'); |
---|
1264 | if val > length(displ_pair) |
---|
1265 | set(handles.list_pair_civ,'Value',1);% first pair proposed by default in the menu |
---|
1266 | val=1; |
---|
1267 | end |
---|
1268 | iview=get(handles.NomType,'Value'); |
---|
1269 | SeriesData.displ_num(iview,:)=(displ_num(:,val))'; |
---|
1270 | SeriesData.ref_time=ref_time; |
---|
1271 | set(handles.series,'UserData',SeriesData) |
---|
1272 | list_pair_civ_Callback([],[],handles) |
---|
1273 | |
---|
1274 | %------------------------------------------------------------- |
---|
1275 | % --- Executes on selection in list_pair_civ. |
---|
1276 | function list_pair_civ_Callback(hObject,eventdata,handles) |
---|
1277 | %------------------------------------------------------------ |
---|
1278 | return |
---|
1279 | %%%%%%%% |
---|
1280 | %update num_first_i and num_last_i according to the chosen image pairs |
---|
1281 | testupdate=0; |
---|
1282 | Val=get(handles.RootPath,'Value'); |
---|
1283 | IndexCell=get(handles.NomType,'String'); |
---|
1284 | SeriesData=get(handles.series,'UserData'); |
---|
1285 | NomType=SeriesData.NomType{Val}; |
---|
1286 | list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs |
---|
1287 | index_pair=get(handles.list_pair_civ,'Value'); |
---|
1288 | str_pair=list_pair{index_pair}; |
---|
1289 | ind_equ=strfind(str_pair,'=');%find '=' |
---|
1290 | ind_sep=strfind(str_pair,'|');%find pair separator '|' |
---|
1291 | ind_com=strfind(str_pair,':');%find ':' |
---|
1292 | test_bursts=0; |
---|
1293 | if isempty(ind_sep) |
---|
1294 | ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|' |
---|
1295 | test_bursts=1;% we are in the case of bursts |
---|
1296 | end |
---|
1297 | displ_num=[0 0 0 0]; %default |
---|
1298 | if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-') |
---|
1299 | num1_str=str_pair(ind_equ(1)+1:ind_sep-1); |
---|
1300 | num2_str=str_pair(ind_sep+1:ind_com-1); |
---|
1301 | num1=str2double(num1_str); |
---|
1302 | num2=str2double(num2_str); |
---|
1303 | if isequal(num1_str(1),' ') |
---|
1304 | num1_str(1)=[]; |
---|
1305 | end |
---|
1306 | if isequal(num2_str(end),' ') |
---|
1307 | num2_str(end)=[]; |
---|
1308 | end |
---|
1309 | switch NomType |
---|
1310 | case {'_1-2_1'} |
---|
1311 | if isequal(num1_str(1),'0') |
---|
1312 | IndexCell{Val}=['_(i-(i+' num2_str ')_j']; |
---|
1313 | else |
---|
1314 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j']; |
---|
1315 | end |
---|
1316 | displ_num(3)=num1; |
---|
1317 | displ_num(4)=num2; |
---|
1318 | case {'_1-2'} |
---|
1319 | if isequal(num1_str(1),'0') |
---|
1320 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
1321 | else |
---|
1322 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
1323 | end |
---|
1324 | displ_num(3)=num1; |
---|
1325 | displ_num(4)=num2; |
---|
1326 | case '_1_1-2' |
---|
1327 | if test_bursts |
---|
1328 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
1329 | else |
---|
1330 | if isequal(num1_str(1),'0') |
---|
1331 | IndexCell{Val}=['_i_j-(j+' num2_str ')']; |
---|
1332 | else |
---|
1333 | IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')']; |
---|
1334 | end |
---|
1335 | end |
---|
1336 | displ_num(1)=num1; |
---|
1337 | displ_num(2)=num2; |
---|
1338 | case {'#_ab'} %TO COMPLETE |
---|
1339 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
1340 | |
---|
1341 | end |
---|
1342 | end |
---|
1343 | set(handles.NomType,'String',IndexCell) |
---|
1344 | SeriesData.displ_num(Val,:)=displ_num; |
---|
1345 | set(handles.series,'UserData',SeriesData) |
---|
1346 | % set(handles.NomType,'Value',Val) |
---|
1347 | |
---|
1348 | if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*') |
---|
1349 | mode_list=get(handles.mode,'String'); |
---|
1350 | mode_value=get(handles.mode,'Value'); |
---|
1351 | mode=mode_list{mode_value}; |
---|
1352 | if isequal(mode,'series(Di)') |
---|
1353 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
1354 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
1355 | incr_i=str2num(get(handles.num_incr_i,'String')); |
---|
1356 | num1=first_i:incr_i:last_i; |
---|
1357 | lastfieldCell=get(handles.num_MaxIndex_i,'String'); |
---|
1358 | lastfield=str2num(lastfieldCell{1}); |
---|
1359 | if ~isempty(lastfield) |
---|
1360 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
1361 | num1=num1(ind); |
---|
1362 | end |
---|
1363 | if ~isempty(num1) |
---|
1364 | set(handles.num_first_i,'String',num2str(num1(1))); |
---|
1365 | set(handles.num_last_i,'String',num2str(num1(end))); |
---|
1366 | end |
---|
1367 | testupdate=1; |
---|
1368 | elseif isequal(mode,'series(Dj)') |
---|
1369 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
1370 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
1371 | incr_j=str2num(get(handles.num_incr_j,'String')); |
---|
1372 | num_j=first_j:incr_j:last_j; |
---|
1373 | lastfieldCell=get(handles.num_MaxIndex_j,'String'); |
---|
1374 | if ~isempty(lastfieldCell) |
---|
1375 | lastfield2=lastfieldCell{1}; |
---|
1376 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
1377 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
1378 | end |
---|
1379 | testupdate=1; |
---|
1380 | end |
---|
1381 | |
---|
1382 | %update the first and last times of the series |
---|
1383 | if testupdate && isfield(SeriesData,'Time') |
---|
1384 | if ~isempty(SeriesData.Time{1}) |
---|
1385 | displ_time(handles,SeriesData.Time{1}); |
---|
1386 | end |
---|
1387 | end |
---|
1388 | end |
---|
1389 | |
---|
1390 | %------------------------------------------------------------------------ |
---|
1391 | % --- Executes on button press in RUN. |
---|
1392 | function RUN_Callback(hObject, eventdata, handles) |
---|
1393 | %------------------------------------------------------------------------ |
---|
1394 | %% read root name and field type |
---|
1395 | set(handles.RUN,'BusyAction','queue'); |
---|
1396 | set(0,'CurrentFigure',handles.series) |
---|
1397 | if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) |
---|
1398 | Series.GetObject=1; |
---|
1399 | GetObject_Callback(hObject, eventdata, handles) |
---|
1400 | else |
---|
1401 | Series.GetObject=0; |
---|
1402 | end |
---|
1403 | SeriesData=get(handles.series,'UserData'); |
---|
1404 | |
---|
1405 | % Series.hseries=handles.series; % handles to the series GUI |
---|
1406 | |
---|
1407 | %% Read parameters from series |
---|
1408 | Series=read_GUI(handles.series);%TODO: extend to all input param |
---|
1409 | Series.hseries=handles.series; % handles to the series GUI |
---|
1410 | |
---|
1411 | first_i=1; |
---|
1412 | last_i=1; |
---|
1413 | incr_i=1; |
---|
1414 | first_j=1; |
---|
1415 | last_j=1; |
---|
1416 | incr_j=1; |
---|
1417 | if isfield(Series.IndexRange,'first_i') |
---|
1418 | first_i=Series.IndexRange.first_i; |
---|
1419 | incr_i=Series.IndexRange.incr_i; |
---|
1420 | last_i=Series.IndexRange.last_i; |
---|
1421 | end |
---|
1422 | if isfield(Series.IndexRange,'first_j') |
---|
1423 | first_j=Series.IndexRange.first_j; |
---|
1424 | incr_j=Series.IndexRange.incr_j; |
---|
1425 | last_j=Series.IndexRange.last_j; |
---|
1426 | end |
---|
1427 | |
---|
1428 | %% read input file parameters and set menus |
---|
1429 | Series.PathProject=get(handles.PathCampaign,'String'); |
---|
1430 | RootPath=get(handles.RootPath,'String');% path of the root name of the first field series |
---|
1431 | RootFile=get(handles.RootFile,'String');% root name of the first field series |
---|
1432 | SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files |
---|
1433 | FileExt=get(handles.FileExt,'String');%file extension |
---|
1434 | if isempty(SeriesData) |
---|
1435 | msgbox_uvmat('ERROR','no input file series') |
---|
1436 | return |
---|
1437 | end |
---|
1438 | NomType=SeriesData.NomType; |
---|
1439 | if length(RootPath)==1 %string character input for user fct |
---|
1440 | Series.RootPath=RootPath{1}; |
---|
1441 | Series.RootFile=RootFile{1}; |
---|
1442 | Series.SubDir=SubDir{1}; |
---|
1443 | Series.FileExt=FileExt{1}; |
---|
1444 | Series.NomType=NomType{1}; |
---|
1445 | else %cell input for user fct |
---|
1446 | Series.RootPath=RootPath; |
---|
1447 | Series.RootFile=RootFile; |
---|
1448 | Series.SubDir=SubDir; |
---|
1449 | Series.FileExt=FileExt; |
---|
1450 | Series.NomType=NomType; |
---|
1451 | end |
---|
1452 | if isequal(get(handles.FieldMenu,'Visible'),'on') |
---|
1453 | FieldMenu=get(handles.FieldMenu,'String'); |
---|
1454 | FieldValue=get(handles.FieldMenu,'Value'); |
---|
1455 | Series.Field=FieldMenu(FieldValue); |
---|
1456 | end |
---|
1457 | menu_coord_state=get(handles.transform_fct,'Visible'); |
---|
1458 | Series.CoordType='';%default |
---|
1459 | if isequal(menu_coord_state,'on') |
---|
1460 | % menu_coord=get(handles.transform_fct,'String'); |
---|
1461 | menu_index=get(handles.transform_fct,'Value'); |
---|
1462 | transform_list=get(handles.transform_fct,'UserData'); |
---|
1463 | Series.transform_fct=transform_list{menu_index};% transform function handles |
---|
1464 | end |
---|
1465 | |
---|
1466 | % |
---|
1467 | % first_i=str2num(get(handles.num_first_i,'String')); |
---|
1468 | % last_i=str2num(get(handles.num_last_i,'String')); |
---|
1469 | % incr_i=str2num(get(handles.num_incr_i,'String')); |
---|
1470 | % first_j=str2num(get(handles.num_first_j,'String')); |
---|
1471 | % last_j=str2num(get(handles.num_last_j,'String')); |
---|
1472 | % incr_j=str2num(get(handles.num_incr_j,'String')); |
---|
1473 | % if ~isequal(get(handles.num_first_i,'Visible'),'on') |
---|
1474 | % first_i=1; |
---|
1475 | % last_i=1; |
---|
1476 | % incr_i=1; |
---|
1477 | % end |
---|
1478 | % if ~isequal(get(handles.num_first_j,'Visible'),'on') |
---|
1479 | % first_j=1; |
---|
1480 | % last_j=1; |
---|
1481 | % incr_j=1; |
---|
1482 | % end |
---|
1483 | |
---|
1484 | %reinitiate waitbar position |
---|
1485 | Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS |
---|
1486 | waitbarpos=Series.WaitbarPos; |
---|
1487 | waitbarpos(4)=0.005;%reinitialize waitbar to zero height |
---|
1488 | waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005; |
---|
1489 | % set(handles.waitbar,'Position',waitbarpos) |
---|
1490 | |
---|
1491 | |
---|
1492 | Series.NbSlice=Series.IndexRange.NbSlice; |
---|
1493 | if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... |
---|
1494 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
1495 | num_i=first_i:incr_i:last_i; |
---|
1496 | num_j=first_j:incr_j:last_j; |
---|
1497 | nbfield_cell=get(handles.num_MaxIndex_i,'String'); |
---|
1498 | nbfield=[]; %default |
---|
1499 | for iview=1:length(nbfield_cell) |
---|
1500 | nb=str2num(nbfield_cell{iview}); |
---|
1501 | if ~isempty(nb) |
---|
1502 | nbfield=[nbfield nb]; |
---|
1503 | end |
---|
1504 | end |
---|
1505 | nbfield=min(nbfield); |
---|
1506 | nbfield2_cell=get(handles.num_MaxIndex_j,'String'); |
---|
1507 | nbfield2=[]; %default |
---|
1508 | for iview=1:length(nbfield2_cell) |
---|
1509 | nb=str2num(nbfield2_cell{iview}); |
---|
1510 | if ~isempty(nb) |
---|
1511 | nbfield2=[nbfield2 nb]; |
---|
1512 | end |
---|
1513 | end |
---|
1514 | nbfield2=min(nbfield2); |
---|
1515 | |
---|
1516 | %get complementary information from the 'series' interface |
---|
1517 | list_action=get(handles.ACTION,'String');% list menu action |
---|
1518 | index_action=get(handles.ACTION,'Value');% selected string index |
---|
1519 | action= list_action{index_action}; % selected string |
---|
1520 | mode_list=get(handles.mode,'String'); |
---|
1521 | index_mode=get(handles.mode,'Value'); |
---|
1522 | mode=mode_list{index_mode}; |
---|
1523 | ind_shift=0;%default |
---|
1524 | |
---|
1525 | %determine the list of input file names |
---|
1526 | nbmissing=0; |
---|
1527 | for iview=1:length(RootPath) |
---|
1528 | %case of pairs (.nc files) |
---|
1529 | fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview}); |
---|
1530 | if strcmp(get(handles.Pairs,'Visible'),'on') |
---|
1531 | pair_list=get(handles.list_pair_civ,'String'); |
---|
1532 | val=get(handles.list_pair_civ,'Value'); |
---|
1533 | pair_string=pair_list{val}; |
---|
1534 | r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names'); |
---|
1535 | if ~isempty(r) |
---|
1536 | if strcmp(r.num1,'*')%free pairs |
---|
1537 | [~,RootFile,i1_series,i2_series,j1_series,j2_series,~,~,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice |
---|
1538 | |
---|
1539 | if isempty(i2_series) %j pairs |
---|
1540 | ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j; |
---|
1541 | j2_series=j2_series(ind_sel); |
---|
1542 | else%i pairs |
---|
1543 | if isempty(j1_series) %j pairs |
---|
1544 | ind_sel=i1_series>=first_i & i2_series<=last_i ; |
---|
1545 | else |
---|
1546 | ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j; |
---|
1547 | j1_series=j1_series(ind_sel); |
---|
1548 | i2_series=i2_series(ind_sel); |
---|
1549 | end |
---|
1550 | end |
---|
1551 | i1_series=i1_series(ind_sel); |
---|
1552 | else |
---|
1553 | if strcmp(r.delim,'-') |
---|
1554 | ind_shift(1)=str2num(r.num1); |
---|
1555 | ind_shift(2)=str2num(r.num2); |
---|
1556 | else |
---|
1557 | ind_shift(1)=-str2num(r.num1); |
---|
1558 | ind_shift(2)=str2num(r.num2); |
---|
1559 | end |
---|
1560 | [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); |
---|
1561 | end |
---|
1562 | end |
---|
1563 | if isempty(i1_series) |
---|
1564 | msgbox_uvmat('ERROR','no file in the considered range') |
---|
1565 | return |
---|
1566 | end |
---|
1567 | if isempty(i2_series) |
---|
1568 | i2_series=i1_series; |
---|
1569 | end |
---|
1570 | if isempty(j2_series) |
---|
1571 | j2_series=j1_series; |
---|
1572 | end |
---|
1573 | % if isequal(NomType{iview},'_1_1-2')|| isequal(NomType{iview},'_1-2_1')|| isequal(NomType{iview},'_1-2')|| isequal(NomType{iview},'#_ab') |
---|
1574 | % ind_shift=SeriesData.displ_num(iview,:); |
---|
1575 | % if isequal(ind_shift,[0 0 0 0]) % undefined pairs |
---|
1576 | % if isequal(NomType{iview},'#_ab') |
---|
1577 | % mode='#_ab'; |
---|
1578 | % end |
---|
1579 | % [num_i1,i2_series,j1_series,num_j2,nbmissing]=netseries_generator(fullfile(RootPath{iview},RootFile{iview}),SubDir{iview},mode,num_first_i,num_incr_i,num_last_i,num_first_j,num_incr_j,num_last_j); |
---|
1580 | % else |
---|
1581 | % [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); |
---|
1582 | % if isempty(num_i) |
---|
1583 | % msgbox_uvmat('ERROR','ERROR: empty set of input files chosen') |
---|
1584 | % return |
---|
1585 | % end |
---|
1586 | % if num_i(1)>num_first_i |
---|
1587 | % set(handles.num_first_i,'String',num2str(num_i(1)))%update the display of first field |
---|
1588 | % last_i_Callback(hObject, eventdata, handles) |
---|
1589 | % end |
---|
1590 | % if num_i(end)<num_last_i |
---|
1591 | % set(handles.num_last_i,'String',num2str(num_i(end)))%update the display of last field |
---|
1592 | % last_i_Callback(hObject, eventdata, handles) |
---|
1593 | % end |
---|
1594 | % if num_j(1)>num_first_j |
---|
1595 | % set(handles.num_first_j,'String',num2str(num_j(1)))%update the display of first field |
---|
1596 | % last_j_Callback(hObject, eventdata, handles) |
---|
1597 | % end |
---|
1598 | % if num_j(end)<num_last_j |
---|
1599 | % set(handles.num_last_j,'String',num2str(num_j(end)))%update the display of last field |
---|
1600 | % last_j_Callback(hObject, eventdata, handles) |
---|
1601 | % end |
---|
1602 | % end |
---|
1603 | else%case of images |
---|
1604 | [i1_series,j1_series]=meshgrid(num_i,num_j); |
---|
1605 | i2_series=i1_series; |
---|
1606 | j2_series=j1_series; |
---|
1607 | end |
---|
1608 | if length(RootPath)>1 |
---|
1609 | i1_series_cell{iview}=i1_series; |
---|
1610 | i2_series_cell{iview}=i2_series; |
---|
1611 | j1_series_cell{iview}=j1_series; |
---|
1612 | j2_series_cell{iview}=j2_series; |
---|
1613 | end |
---|
1614 | end |
---|
1615 | |
---|
1616 | % defining the ACTION function handle |
---|
1617 | path_series=which('series'); |
---|
1618 | list_path=get(handles.ACTION,'UserData'); |
---|
1619 | index=get(handles.ACTION,'Value'); |
---|
1620 | fct_path=list_path{index}; %path stored for the function ACTION |
---|
1621 | if ~isequal(fct_path,path_series) |
---|
1622 | eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION |
---|
1623 | if ~exist(fct_path,'dir') |
---|
1624 | msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist']) |
---|
1625 | return |
---|
1626 | end |
---|
1627 | if ~isequal(spath,fct_path) |
---|
1628 | addpath(fct_path)% add the prescribed path if not the current one |
---|
1629 | end |
---|
1630 | end |
---|
1631 | eval(['h_fun=@' action ';'])%create a function handle for ACTION |
---|
1632 | if ~isequal(fct_path,path_series) |
---|
1633 | rmpath(fct_path)% add the prescribed path if not the current one |
---|
1634 | end |
---|
1635 | |
---|
1636 | % RUN ACTION |
---|
1637 | Series.Action=action;%name of the processing programme |
---|
1638 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
1639 | if length(RootPath)>1 |
---|
1640 | h_fun(i1_series_cell,i2_series_cell,j1_series_cell,j2_series_cell,Series); |
---|
1641 | else |
---|
1642 | h_fun(i1_series,i2_series,j1_series,j2_series,Series); |
---|
1643 | end |
---|
1644 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1645 | |
---|
1646 | % %save the current interface setting as figure namefig, append .0 to the name if it already exists |
---|
1647 | % detect=1; |
---|
1648 | % while detect==1 |
---|
1649 | % namefigfull=[namedoc '.fig']; |
---|
1650 | % hh=dir(namefigfull); |
---|
1651 | % if ~isempty(hh) |
---|
1652 | % detect=1; |
---|
1653 | % namedoc=[namedoc '.0']; |
---|
1654 | % else |
---|
1655 | % detect=0; |
---|
1656 | % end |
---|
1657 | % end |
---|
1658 | % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
1659 | |
---|
1660 | %------------------------------------------------------------------------ |
---|
1661 | function STOP_Callback(hObject, eventdata, handles) |
---|
1662 | %------------------------------------------------------------------------ |
---|
1663 | set(handles.RUN, 'BusyAction','cancel') |
---|
1664 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
1665 | |
---|
1666 | |
---|
1667 | %------------------------------------------------------------------------ |
---|
1668 | function num_first_i_Callback(hObject, eventdata, handles) |
---|
1669 | %------------------------------------------------------------------------ |
---|
1670 | last_i_Callback(hObject, eventdata, handles) |
---|
1671 | |
---|
1672 | %------------------------------------------------------------------------ |
---|
1673 | function num_last_i_Callback(hObject, eventdata, handles) |
---|
1674 | %------------------------------------------------------------------------ |
---|
1675 | SeriesData=get(handles.series,'UserData'); |
---|
1676 | if ~isfield(SeriesData,'Time') |
---|
1677 | SeriesData.Time{1}=[]; |
---|
1678 | end |
---|
1679 | displ_time(handles,SeriesData.Time{1}); |
---|
1680 | |
---|
1681 | %------------------------------------------------------------------------ |
---|
1682 | function num_first_j_Callback(hObject, eventdata, handles) |
---|
1683 | %------------------------------------------------------------------------ |
---|
1684 | last_j_Callback(hObject, eventdata, handles) |
---|
1685 | |
---|
1686 | %------------------------------------------------------------------------ |
---|
1687 | function num_last_j_Callback(hObject, eventdata, handles) |
---|
1688 | %------------------------------------------------------------------------ |
---|
1689 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
1690 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
1691 | ref_j=ceil((first_j+last_j)/2); |
---|
1692 | set(handles.ref_j,'String', num2str(ref_j)) |
---|
1693 | ref_j_Callback(hObject, eventdata, handles) |
---|
1694 | SeriesData=get(handles.series,'UserData'); |
---|
1695 | if ~isfield(SeriesData,'Time') |
---|
1696 | SeriesData.Time{1}=[]; |
---|
1697 | end |
---|
1698 | displ_time(handles,SeriesData.Time{1}); |
---|
1699 | |
---|
1700 | |
---|
1701 | %------------------------------------------------------------------------ |
---|
1702 | function ref_i_Callback(hObject, eventdata, handles) |
---|
1703 | %------------------------------------------------------------------------ |
---|
1704 | mode_list=get(handles.mode,'String'); |
---|
1705 | mode_value=get(handles.mode,'Value'); |
---|
1706 | mode=mode_list{mode_value}; |
---|
1707 | SeriesData=get(handles.series,'UserData'); |
---|
1708 | %NomTypeCell=get(handles.NomType,'String'); |
---|
1709 | NomTypeCell=SeriesData.NomType; |
---|
1710 | if ~isempty(NomTypeCell) |
---|
1711 | Val=get(handles.NomType,'Value'); |
---|
1712 | NomType=NomTypeCell{Val}; |
---|
1713 | % for ilist=1:length(NomType) |
---|
1714 | if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') |
---|
1715 | if isequal(mode,'series(Di)') |
---|
1716 | find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
1717 | % break |
---|
1718 | end |
---|
1719 | end |
---|
1720 | end |
---|
1721 | |
---|
1722 | %------------------------------------------------------------------------ |
---|
1723 | function ref_j_Callback(hObject, eventdata, handles) |
---|
1724 | %------------------------------------------------------------------------ |
---|
1725 | mode_list=get(handles.mode,'String'); |
---|
1726 | mode_value=get(handles.mode,'Value'); |
---|
1727 | mode=mode_list{mode_value}; |
---|
1728 | SeriesData=get(handles.series,'UserData'); |
---|
1729 | NomTypeCell=SeriesData.NomType; |
---|
1730 | if ~isempty(NomTypeCell) |
---|
1731 | Val=get(handles.NomType,'Value'); |
---|
1732 | NomType=NomTypeCell{Val}; |
---|
1733 | if isequal(NomType,'_1_1-2')|| isequal(NomType,'_1-2_1')|| isequal(NomType,'_1-2') |
---|
1734 | if isequal(mode,'series(Dj)') |
---|
1735 | find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
1736 | end |
---|
1737 | end |
---|
1738 | end |
---|
1739 | |
---|
1740 | %------------------------------------------------------------------------ |
---|
1741 | % --- Executes on selection change in ACTION. |
---|
1742 | function ACTION_Callback(hObject, eventdata, handles) |
---|
1743 | %------------------------------------------------------------------------ |
---|
1744 | global nb_builtin_ACTION |
---|
1745 | list_ACTION=get(handles.ACTION,'String');% list menu fields |
---|
1746 | index_ACTION=get(handles.ACTION,'Value');% selected string index |
---|
1747 | ACTION= list_ACTION{index_ACTION}; % selected function name |
---|
1748 | path_series=which('series');%path to series.m |
---|
1749 | list_path=get(handles.ACTION,'UserData');%list of recorded paths to functions of the list ACTION |
---|
1750 | default_file=fullfile(list_path{end},ACTION); |
---|
1751 | % add a new function to the menu if the selected item is 'more...' |
---|
1752 | if isequal(ACTION,'more...') |
---|
1753 | pathfct=fileparts(path_series); |
---|
1754 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
1755 | {'*.m', ' (*.m)'; |
---|
1756 | '*.m', '.m files '; ... |
---|
1757 | '*.*', 'All Files (*.*)'}, ... |
---|
1758 | 'Pick a file',default_file); |
---|
1759 | if length(FileName)<2 |
---|
1760 | return |
---|
1761 | end |
---|
1762 | [pp,ACTION,ext_fct]=fileparts(FileName);%(end-1:end); |
---|
1763 | if ~isequal(ext_fct,'.m') |
---|
1764 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
1765 | return |
---|
1766 | end |
---|
1767 | |
---|
1768 | % insert the choice in the action menu |
---|
1769 | menu_str=update_menu(handles.ACTION,ACTION);%new action menu in which the new item has been appended if needed |
---|
1770 | index_ACTION=get(handles.ACTION,'Value');% currently selected index in the list |
---|
1771 | list_path{index_ACTION}=PathName; |
---|
1772 | if length(menu_str)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu |
---|
1773 | nbremove=length(menu_str)-nb_builtin_ACTION-5; |
---|
1774 | menu_str(nb_builtin_ACTION+1:end-5)=[]; |
---|
1775 | list_path(nb_builtin_ACTION+1:end-4)=[]; |
---|
1776 | index_ACTION=index_ACTION-nbremove; |
---|
1777 | set(handles.ACTION,'Value',index_ACTION) |
---|
1778 | set(handles.ACTION,'String',menu_str) |
---|
1779 | end |
---|
1780 | list_path{index_ACTION}=PathName; |
---|
1781 | set(handles.ACTION,'UserData',list_path); |
---|
1782 | set(handles.path,'enable','inactive')% indicate that the current path is accessible (not 'off') |
---|
1783 | |
---|
1784 | %record the current menu in personal file profil_perso |
---|
1785 | dir_perso=prefdir; |
---|
1786 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
1787 | for ilist=nb_builtin_ACTION+1:length(menu_str)-1 |
---|
1788 | series_fct{ilist-nb_builtin_ACTION}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); |
---|
1789 | end |
---|
1790 | if nb_builtin_ACTION+1<=length(menu_str)-1 |
---|
1791 | if exist(profil_perso,'file')% && nb_builtin_ACTION+1>=length(menu_str)-1 |
---|
1792 | save(profil_perso,'series_fct','-append') |
---|
1793 | else |
---|
1794 | txt=ver('MATLAB'); |
---|
1795 | Release=txt.Release; |
---|
1796 | relnumb=str2num(Release(3:4)); |
---|
1797 | if relnumb >= 14%recent relaese of Matlab |
---|
1798 | save(profil_perso,'series_fct','-V6') |
---|
1799 | else |
---|
1800 | save(profil_perso, 'series_fct') |
---|
1801 | end |
---|
1802 | end |
---|
1803 | end |
---|
1804 | end |
---|
1805 | |
---|
1806 | %check the current path to the selected function |
---|
1807 | PathName=list_path{index_ACTION};%current recorded path |
---|
1808 | set(handles.path,'String',PathName); %show the path to the senlected function |
---|
1809 | |
---|
1810 | %default setting for the visibility of the GUI elements |
---|
1811 | set(handles.RootPath,'UserData','many') |
---|
1812 | set(handles.SubDir,'Visible','on') |
---|
1813 | set(handles.RootFile,'Visible','on') |
---|
1814 | set(handles.NomType,'Visible','on') |
---|
1815 | set(handles.FileExt,'Visible','on') |
---|
1816 | set(handles.num_NbSlice,'Visible','off') |
---|
1817 | set(handles.NbSlice_title,'Visible','off') |
---|
1818 | set(handles.VelTypeMenu,'Visible','off'); |
---|
1819 | set(handles.VelType_text,'Visible','off'); |
---|
1820 | set(handles.VelTypeMenu_1,'Visible','off'); |
---|
1821 | set(handles.VelType_text_1,'Visible','off'); |
---|
1822 | view_FieldMenu(handles,'off') |
---|
1823 | view_FieldMenu_1(handles,'off') |
---|
1824 | set(handles.FieldTransform,'Visible','off') |
---|
1825 | % view_TRANSFORM(handles,'off')Visible','off') |
---|
1826 | set(handles.Objects,'Visible','off'); |
---|
1827 | set(handles.GetMask,'Visible','off') |
---|
1828 | set(handles.Mask,'Visible','off') |
---|
1829 | % set(handles.GetObject,'Visible','off'); |
---|
1830 | set(handles.OutputDir,'Visible','off'); |
---|
1831 | % set(handles.PARAMETERS_frame,'Visible','off'); |
---|
1832 | % set(handles.PARAMETERS_title,'Visible','off'); |
---|
1833 | set(handles.ParamKey,'Visible','off') |
---|
1834 | set(handles.ParamVal,'Visible','off') |
---|
1835 | ParamKey={}; |
---|
1836 | set(handles.FieldMenu,'Enable','off') |
---|
1837 | set(handles.VelTypeMenu,'Enable','off') |
---|
1838 | set(handles.FieldMenu_1,'Enable','off') |
---|
1839 | set(handles.VelTypeMenu_1,'Enable','off') |
---|
1840 | set(handles.transform_fct,'Enable','off') |
---|
1841 | %set the displayed GUI item needed for input parameters |
---|
1842 | if ~isequal(path_series,PathName) |
---|
1843 | addpath(PathName) |
---|
1844 | end |
---|
1845 | eval(['h_function=@' ACTION ';']); |
---|
1846 | try |
---|
1847 | [fid,errormsg] =fopen([ACTION '.m']); |
---|
1848 | InputText=textscan(fid,'%s',1,'delimiter','\n'); |
---|
1849 | fclose(fid) |
---|
1850 | set(handles.ACTION,'ToolTipString',InputText{1}{1}) |
---|
1851 | end |
---|
1852 | if ~isequal(path_series,PathName) |
---|
1853 | rmpath(PathName) |
---|
1854 | end |
---|
1855 | varargout=h_function(); |
---|
1856 | Param_list={}; |
---|
1857 | |
---|
1858 | %nb_series=length(RootFile); |
---|
1859 | FileExt=get(handles.FileExt,'String'); |
---|
1860 | nb_series=length(FileExt); |
---|
1861 | testima_series=1; %test for a list of images only |
---|
1862 | testima=1; |
---|
1863 | testima_1=1; |
---|
1864 | testciv_series=1; |
---|
1865 | for iview=1:nb_series |
---|
1866 | ext=FileExt{iview}; |
---|
1867 | if length(ext)<2 |
---|
1868 | ext='.none'; |
---|
1869 | end |
---|
1870 | testimaview=~isempty(imformats(ext(2:end))) || isequal(lower(ext),'.avi'); |
---|
1871 | if ~testimaview |
---|
1872 | if iview==1 |
---|
1873 | testima=0; |
---|
1874 | end |
---|
1875 | if iview==2 |
---|
1876 | testima_1=0; |
---|
1877 | end |
---|
1878 | testima_series=0; |
---|
1879 | end |
---|
1880 | end |
---|
1881 | for ilist=1:length(varargout)-1 |
---|
1882 | switch varargout{ilist} |
---|
1883 | %RootFile always visible |
---|
1884 | case 'RootPath' %visible by default |
---|
1885 | value=lower(varargout{ilist+1}); |
---|
1886 | if isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
1887 | set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
1888 | end |
---|
1889 | case 'SubDir' %visible by default |
---|
1890 | if isequal(lower(varargout{ilist+1}),'off') |
---|
1891 | set(handles.SubDir,'Visible','off') |
---|
1892 | end |
---|
1893 | case 'RootFile' %visible by default |
---|
1894 | value=lower(varargout{ilist+1}); |
---|
1895 | if isequal(value,'off') |
---|
1896 | set(handles.RootFile,'Visible','off') |
---|
1897 | elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
1898 | set(handles.RootFile,'Visible','on') |
---|
1899 | set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
1900 | end |
---|
1901 | case 'NomType' %visible by default |
---|
1902 | if isequal(lower(varargout{ilist+1}),'off') |
---|
1903 | set(handles.NomType,'Visible','off') |
---|
1904 | end |
---|
1905 | case 'FileExt' %visible by default |
---|
1906 | if isequal(lower(varargout{ilist+1}),'off') |
---|
1907 | set(handles.FileExt,'Visible','off') |
---|
1908 | end |
---|
1909 | case 'NbSlice' %hidden by default |
---|
1910 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1911 | set(handles.num_NbSlice,'Visible','on') |
---|
1912 | set(handles.NbSlice_title,'Visible','on') |
---|
1913 | end |
---|
1914 | case 'VelTypeMenu' %hidden by default |
---|
1915 | if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') |
---|
1916 | set(handles.VelTypeMenu,'Enable','on') |
---|
1917 | if nb_series >=1 && ~testima_series |
---|
1918 | set(handles.VelTypeMenu,'Visible','on') |
---|
1919 | set(handles.VelType_text,'Visible','on'); |
---|
1920 | set(handles.Field_frame,'Visible','on') |
---|
1921 | end |
---|
1922 | end |
---|
1923 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1924 | set(handles.VelTypeMenu_1,'Enable','on') |
---|
1925 | if nb_series >=2 && ~testima_series |
---|
1926 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
1927 | set(handles.VelType_text_1,'Visible','on'); |
---|
1928 | end |
---|
1929 | end |
---|
1930 | case 'FieldMenu' %hidden by default |
---|
1931 | if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') |
---|
1932 | set(handles.FieldMenu,'Enable','on') % test for MenuBorser |
---|
1933 | if nb_series >=1 && ~testima_series |
---|
1934 | view_FieldMenu(handles,'on') |
---|
1935 | end |
---|
1936 | end |
---|
1937 | if isequal(lower(varargout{ilist+1}),'two') |
---|
1938 | set(handles.FieldMenu_1,'Enable','on') |
---|
1939 | if nb_series >=2 && ~testima_1 |
---|
1940 | view_FieldMenu_1(handles,'on') |
---|
1941 | end |
---|
1942 | end |
---|
1943 | case 'CoordType' %hidden by default |
---|
1944 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1945 | set(handles.transform_fct,'Enable','on') |
---|
1946 | set(handles.FieldTransform,'Visible','on') |
---|
1947 | % view_TRANSFORM(handles,'on') |
---|
1948 | end |
---|
1949 | case 'GetObject' %hidden by default |
---|
1950 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1951 | set(handles.Objects,'Visible','on') |
---|
1952 | % set(handles.GetObject,'Visible','on'); |
---|
1953 | end |
---|
1954 | case 'Mask' %hidden by default |
---|
1955 | if isequal(lower(varargout{ilist+1}),'on') |
---|
1956 | set(handles.Objects,'Visible','on') |
---|
1957 | % set(handles.GetMask,'Visible','on'); |
---|
1958 | end |
---|
1959 | case 'PARAMETER' |
---|
1960 | set(handles.PARAMETERS_frame,'Visible','on') |
---|
1961 | set(handles.PARAMETERS_title,'Visible','on') |
---|
1962 | set(handles.ParamKey,'Visible','on') |
---|
1963 | %set(handles.ParamVal,'Visible','on') |
---|
1964 | Param_str=varargout{ilist+1}; |
---|
1965 | Param_list=[Param_list; {Param_str}]; |
---|
1966 | end |
---|
1967 | end |
---|
1968 | if ~isempty(Param_list) |
---|
1969 | set(handles.ParamKey,'String',Param_list) |
---|
1970 | set(handles.ParamVal,'Visible','on') |
---|
1971 | end |
---|
1972 | |
---|
1973 | %------------------------------------------------------------------------ |
---|
1974 | % --- Executes on selection change in FieldMenu. |
---|
1975 | function FieldMenu_Callback(hObject, eventdata, handles) |
---|
1976 | %------------------------------------------------------------------------ |
---|
1977 | field_str=get(handles.FieldMenu,'String'); |
---|
1978 | field_index=get(handles.FieldMenu,'Value'); |
---|
1979 | field=field_str{field_index(1)}; |
---|
1980 | if isequal(field,'get_field...') |
---|
1981 | hget_field=findobj(allchild(0),'name','get_field'); |
---|
1982 | if ~isempty(hget_field) |
---|
1983 | delete(hget_field)%delete opened versions of get_field |
---|
1984 | end |
---|
1985 | SeriesData=get(handles.series,'UserData'); |
---|
1986 | filename=SeriesData.CurrentInputFile; |
---|
1987 | if exist(filename,'file') |
---|
1988 | get_field(filename) |
---|
1989 | end |
---|
1990 | elseif isequal(field,'more...') |
---|
1991 | str=calc_field; |
---|
1992 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
1993 | 'SelectionMode','single',... |
---|
1994 | 'ListString',str); |
---|
1995 | % edit the choice in the fields and action menu |
---|
1996 | scalar=cell2mat(str(ind_answer)); |
---|
1997 | update_menu(handles.FieldMenu,scalar) |
---|
1998 | end |
---|
1999 | |
---|
2000 | %------------------------------------------------------------------------ |
---|
2001 | % --- Executes on selection change in FieldMenu_1. |
---|
2002 | function FieldMenu_1_Callback(hObject, eventdata, handles) |
---|
2003 | %------------------------------------------------------------------------ |
---|
2004 | field_str=get(handles.FieldMenu_1,'String'); |
---|
2005 | field_index=get(handles.FieldMenu_1,'Value'); |
---|
2006 | field=field_str{field_index}; |
---|
2007 | if isequal(field,'get_field...') |
---|
2008 | hget_field=findobj(allchild(0),'name','get_field_1'); |
---|
2009 | if ~isempty(hget_field) |
---|
2010 | delete(hget_field) |
---|
2011 | end |
---|
2012 | SeriesData=get(handles.series,'UserData'); |
---|
2013 | filename=SeriesData.CurrentInputFile_1; |
---|
2014 | if exist(filename,'file') |
---|
2015 | hget_field=get_field(filename); |
---|
2016 | set(hget_field,'name','get_field_1') |
---|
2017 | end |
---|
2018 | elseif isequal(field,'more...') |
---|
2019 | str=calc_field; |
---|
2020 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
2021 | 'SelectionMode','single',... |
---|
2022 | 'ListString',str); |
---|
2023 | % edit the choice in the fields and action menu |
---|
2024 | scalar=cell2mat(str(ind_answer)); |
---|
2025 | update_menu(handles.FieldMenu_1,scalar) |
---|
2026 | end |
---|
2027 | |
---|
2028 | |
---|
2029 | %%%%%%%%%%%%% |
---|
2030 | function [ind_remove]=find_pairs(dirpair,ind_i,last_i) |
---|
2031 | indsel=ind_i; |
---|
2032 | indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series |
---|
2033 | indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds |
---|
2034 | if ~isempty(indiff) |
---|
2035 | indiff2=diff(indiff); |
---|
2036 | indiffp=[indiff2 1]; |
---|
2037 | indiffm=[1 indiff2]; |
---|
2038 | ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets |
---|
2039 | ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets |
---|
2040 | %for each multiplet, select the most recent file |
---|
2041 | ind_remove=[]; |
---|
2042 | for i=1:length(ind_multi_m) |
---|
2043 | ind_pairs=ind_multi_m(i):ind_multi_p(i); |
---|
2044 | for imulti=1:length(ind_pairs) |
---|
2045 | datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation |
---|
2046 | end |
---|
2047 | [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date |
---|
2048 | ind_s=indsort2(1:end-1);% |
---|
2049 | ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one |
---|
2050 | end |
---|
2051 | end |
---|
2052 | |
---|
2053 | %------------------------------------------------------------------------ |
---|
2054 | % --- determine the list of index pairs of processing file |
---|
2055 | 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) |
---|
2056 | %------------------------------------------------------------------------ |
---|
2057 | num_i1=num_i;% set of first image numbers by default |
---|
2058 | num_i2=num_i; |
---|
2059 | num_j1=num_j; |
---|
2060 | num_j2=num_j; |
---|
2061 | num_i_out=num_i; |
---|
2062 | num_j_out=num_j; |
---|
2063 | % if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2') |
---|
2064 | if isequal(mode,'series(Di)') |
---|
2065 | num_i1_line=num_i+ind_shift(3);% set of first image numbers |
---|
2066 | num_i2_line=num_i+ind_shift(4); |
---|
2067 | % adjust the first and last field number |
---|
2068 | indsel=find(num_i1_line >= 1); |
---|
2069 | num_i_out=num_i(indsel); |
---|
2070 | num_i1_line=num_i1_line(indsel); |
---|
2071 | num_i2_line=num_i2_line(indsel); |
---|
2072 | num_j1=meshgrid(num_j,ones(size(num_i1_line))); |
---|
2073 | num_j2=meshgrid(num_j,ones(size(num_i1_line))); |
---|
2074 | [xx,num_i1]=meshgrid(num_j,num_i1_line); |
---|
2075 | [xx,num_i2]=meshgrid(num_j,num_i2_line); |
---|
2076 | elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts') |
---|
2077 | if isequal(mode,'bursts') %case of bursts (png_old or png_2D) |
---|
2078 | num_j1=ind_shift(1)*ones(size(num_i)); |
---|
2079 | num_j2=ind_shift(2)*ones(size(num_i)); |
---|
2080 | else |
---|
2081 | num_j1_col=num_j+ind_shift(1);% set of first image numbers |
---|
2082 | num_j2_col=num_j+ind_shift(2); |
---|
2083 | % adjust the first field number |
---|
2084 | indsel=find((num_j1_col >= 1)); |
---|
2085 | num_j_out=num_j(indsel); |
---|
2086 | num_j1_col=num_j1_col(indsel); |
---|
2087 | num_j2_col=num_j2_col(indsel); |
---|
2088 | [num_i1,num_j1]=meshgrid(num_i,num_j1_col); |
---|
2089 | [num_i2,num_j2]=meshgrid(num_i,num_j2_col); |
---|
2090 | end |
---|
2091 | end |
---|
2092 | |
---|
2093 | %------------------------------------------------------------------------ |
---|
2094 | % ---- find the times corresponding to the first and last indices of a series |
---|
2095 | function displ_time(handles,times) |
---|
2096 | %------------------------------------------------------------------------ |
---|
2097 | SeriesData=get(handles.series,'UserData');% |
---|
2098 | first_i=str2num(get(handles.num_first_i,'String')); |
---|
2099 | first_j=str2num(get(handles.num_first_j,'String')); |
---|
2100 | last_i=str2num(get(handles.num_last_i,'String')); |
---|
2101 | last_j=str2num(get(handles.num_last_j,'String')); |
---|
2102 | NomType=SeriesData.NomType; |
---|
2103 | mode_list=get(handles.mode,'String'); |
---|
2104 | index_mode=get(handles.mode,'Value'); |
---|
2105 | mode=mode_list{index_mode}; |
---|
2106 | |
---|
2107 | time_first=[]; |
---|
2108 | time_last=[]; |
---|
2109 | if ~isfield(SeriesData,'Time') |
---|
2110 | SeriesData.Time{1}=[]; |
---|
2111 | end |
---|
2112 | for iview=1:length(NomType) |
---|
2113 | time_first_cell{iview}='?'; |
---|
2114 | time_last_cell{iview}='?';%default |
---|
2115 | time=SeriesData.Time{iview}; |
---|
2116 | if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') |
---|
2117 | if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) |
---|
2118 | ind_shift=SeriesData.displ_num(iview,:); |
---|
2119 | if isequal(mode,'bursts') |
---|
2120 | first_j=0; |
---|
2121 | last_j=0; |
---|
2122 | end |
---|
2123 | first_i1=first_i +ind_shift(3); |
---|
2124 | first_i2 =first_i +ind_shift(4); |
---|
2125 | first_j1 =first_j +ind_shift(1); |
---|
2126 | first_j2 =first_j +ind_shift(2); |
---|
2127 | last_i1=last_i +ind_shift(3); |
---|
2128 | last_i2 =last_i +ind_shift(4); |
---|
2129 | last_j1 =last_j +ind_shift(1); |
---|
2130 | last_j2 =last_j +ind_shift(2); |
---|
2131 | siz=size(SeriesData.Time{1}); |
---|
2132 | if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 |
---|
2133 | time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; |
---|
2134 | time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; |
---|
2135 | else%read the time in the nc files |
---|
2136 | RootPath=get(handles.RootPath,'String'); |
---|
2137 | RootFile=get(handles.RootFile,'String'); |
---|
2138 | SubDir=get(handles.SubDir,'String'); |
---|
2139 | %VelType=get(handles.VelType,'String'); |
---|
2140 | VelType_str=get(handles.VelTypeMenu,'String'); |
---|
2141 | VelType_val=get(handles.VelTypeMenu,'Value'); |
---|
2142 | VelType=VelType_str{VelType_val}; |
---|
2143 | filebase=fullfile(RootPath{1},RootFile{1}); |
---|
2144 | [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); |
---|
2145 | if exist(filefirst,'file') |
---|
2146 | Attrib=nc2struct(filefirst,[]); |
---|
2147 | if isfield(Attrib,'Time') |
---|
2148 | time_first=Attrib.Time; |
---|
2149 | else |
---|
2150 | if isfield(Attrib,'absolut_time_T0') |
---|
2151 | time_first=Attrib.absolut_time_T0; |
---|
2152 | end |
---|
2153 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
2154 | time_first=Attrib.absolut_time_T0_2; |
---|
2155 | end |
---|
2156 | end |
---|
2157 | end |
---|
2158 | [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); |
---|
2159 | if exist(filelast,'file') |
---|
2160 | Attrib=nc2struct(filelast,[]); |
---|
2161 | if isfield(Attrib,'Time') |
---|
2162 | time_last=Attrib.Time; |
---|
2163 | else |
---|
2164 | if isfield(Attrib,'absolut_time_T0') |
---|
2165 | time_last=Attrib.absolut_time_T0; |
---|
2166 | end |
---|
2167 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
2168 | time_last=Attrib.absolut_time_T0_2; |
---|
2169 | end |
---|
2170 | end |
---|
2171 | end |
---|
2172 | end |
---|
2173 | end |
---|
2174 | else |
---|
2175 | siz=size(times); |
---|
2176 | if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 |
---|
2177 | time_first=times(first_i,first_j); |
---|
2178 | time_last=times(last_i,last_j); |
---|
2179 | end |
---|
2180 | end |
---|
2181 | time_first_cell{iview}=num2str(time_first,4); |
---|
2182 | time_last_cell{iview}=num2str(time_last,4); |
---|
2183 | end |
---|
2184 | set(handles.time_first,'Value',1) |
---|
2185 | set(handles.time_last,'Value',1) |
---|
2186 | set(handles.time_first,'String',time_first_cell); |
---|
2187 | set(handles.time_last,'String',time_last_cell); |
---|
2188 | |
---|
2189 | %------------------------------------------------------------------------ |
---|
2190 | % --- Executes on button press in GetObject. |
---|
2191 | function GetObject_Callback(hObject, eventdata, handles) |
---|
2192 | %------------------------------------------------------------------------ |
---|
2193 | SeriesData=get(handles.series,'UserData'); |
---|
2194 | value=get(handles.GetObject,'Value'); |
---|
2195 | if value |
---|
2196 | set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow |
---|
2197 | % DataInit.ParentButton=handles.GetObject; |
---|
2198 | hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle |
---|
2199 | if ishandle(hset_object) |
---|
2200 | uistack(hset_object,'top') |
---|
2201 | %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface |
---|
2202 | else |
---|
2203 | %get the object file |
---|
2204 | defaultname=get(handles.RootPath,'String'); |
---|
2205 | if isempty(defaultname) |
---|
2206 | defaultname={''}; |
---|
2207 | end |
---|
2208 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2209 | {'*.xml;*.mat', ' (*.xml,*.mat)'; |
---|
2210 | '*.xml', '.xml files '; ... |
---|
2211 | '*.mat', '.mat matlab files '}, ... |
---|
2212 | 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); |
---|
2213 | fileinput=[PathName FileName];%complete file name |
---|
2214 | testblank=findstr(fileinput,' ');%look for blanks |
---|
2215 | if ~isempty(testblank) |
---|
2216 | msgbox_uvmat('ERROR','forbidden input file name: contain blanks') |
---|
2217 | return |
---|
2218 | end |
---|
2219 | sizf=size(fileinput); |
---|
2220 | if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end |
---|
2221 | %read the file |
---|
2222 | t=xmltree(fileinput); |
---|
2223 | data=convert(t); |
---|
2224 | if ~isfield(data,'Style') |
---|
2225 | data.Style='points'; |
---|
2226 | end |
---|
2227 | if ~isfield(data,'ProjMode') |
---|
2228 | data.ProjMode='projection'; |
---|
2229 | end |
---|
2230 | transform_menu=get(handles.transform_fct,'String'); |
---|
2231 | ichoice=get(handles.transform_fct,'Value'); |
---|
2232 | % if isequal(transform_menu{ichoice},'px'); |
---|
2233 | % data.CoordType='px'; |
---|
2234 | % else |
---|
2235 | % data.CoordType='phys'; |
---|
2236 | % end |
---|
2237 | data.desable_plot=1; |
---|
2238 | [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface |
---|
2239 | end |
---|
2240 | else |
---|
2241 | set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green |
---|
2242 | % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) |
---|
2243 | % close(SeriesData.hset_object) |
---|
2244 | % end |
---|
2245 | end |
---|
2246 | set(handles.series,'UserData',SeriesData) |
---|
2247 | |
---|
2248 | %-------------------------------------------------------------- |
---|
2249 | function GetMask_Callback(hObject, eventdata, handles) |
---|
2250 | value=get(handles.GetMask,'Value'); |
---|
2251 | if value |
---|
2252 | msgbox_uvmat('ERROR','not implemented yet') |
---|
2253 | end |
---|
2254 | %-------------------------------------------------------------- |
---|
2255 | |
---|
2256 | %------------------------------------------------------------------- |
---|
2257 | %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m' |
---|
2258 | function ncbrowser_uvmat(hObject, eventdata) |
---|
2259 | %------------------------------------------------------------------- |
---|
2260 | bla=get(gcbo,'String'); |
---|
2261 | ind=get(gcbo,'Value'); |
---|
2262 | filename=cell2mat(bla(ind)); |
---|
2263 | blank=find(filename==' '); |
---|
2264 | filename=filename(1:blank-1); |
---|
2265 | get_field(filename) |
---|
2266 | |
---|
2267 | % ------------------------------------------------------------------ |
---|
2268 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
2269 | %------------------------------------------------------------------- |
---|
2270 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
2271 | pathelp=fileparts(path_to_uvmat); |
---|
2272 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
2273 | 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') |
---|
2274 | else |
---|
2275 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
2276 | web([helpfile '#series']) |
---|
2277 | end |
---|
2278 | |
---|
2279 | %------------------------------------------------------------------- |
---|
2280 | % --- Executes on selection change in transform_fct. |
---|
2281 | function transform_fct_Callback(hObject, eventdata, handles) |
---|
2282 | %------------------------------------------------------------------- |
---|
2283 | global nb_transform |
---|
2284 | |
---|
2285 | menu=get(handles.transform_fct,'String'); |
---|
2286 | ind_coord=get(handles.transform_fct,'Value'); |
---|
2287 | coord_option=menu{ind_coord}; |
---|
2288 | list_transform=get(handles.transform_fct,'UserData'); |
---|
2289 | ff=functions(list_transform{end}); |
---|
2290 | if isequal(coord_option,'more...'); |
---|
2291 | coord_fct=''; |
---|
2292 | prompt = {'Enter the name of the transform function'}; |
---|
2293 | dlg_title = 'user defined transform'; |
---|
2294 | num_lines= 1; |
---|
2295 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
2296 | {'*.m', ' (*.m)'; |
---|
2297 | '*.m', '.m files '; ... |
---|
2298 | '*.*', 'All Files (*.*)'}, ... |
---|
2299 | 'Pick a file', ff.file); |
---|
2300 | if isequal(PathName(end),'/')||isequal(PathName(end),'\') |
---|
2301 | PathName(end)=[]; |
---|
2302 | end |
---|
2303 | transform_selected =fullfile(PathName,FileName); |
---|
2304 | if ~exist(transform_selected,'file') |
---|
2305 | return |
---|
2306 | end |
---|
2307 | [ppp,transform,xt_fct]=fileparts(FileName);% removes extension .m |
---|
2308 | if ~isequal(ext_fct,'.m') |
---|
2309 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
2310 | return |
---|
2311 | end |
---|
2312 | menu=update_menu(handles.transform_fct,transform);%add the selected fct to the menu |
---|
2313 | ind_coord=get(handles.transform_fct,'Value'); |
---|
2314 | addpath(PathName) |
---|
2315 | list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function |
---|
2316 | set(handles.transform_fct,'UserData',list_transform) |
---|
2317 | rmpath(PathName) |
---|
2318 | % save the new menu in the personal file 'uvmat_perso.mat' |
---|
2319 | dir_perso=prefdir;%personal Matalb directory |
---|
2320 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
2321 | if exist(profil_perso,'file') |
---|
2322 | for ilist=nb_transform+1:numel(list_transform) |
---|
2323 | ff=functions(list_transform{ilist}); |
---|
2324 | transform_fct{ilist-nb_transform}=ff.file; |
---|
2325 | end |
---|
2326 | save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat |
---|
2327 | end |
---|
2328 | end |
---|
2329 | |
---|
2330 | %check the current path to the selected function |
---|
2331 | if ~isempty(list_transform{ind_coord}) |
---|
2332 | func=functions(list_transform{ind_coord}); |
---|
2333 | set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function |
---|
2334 | else |
---|
2335 | set(handles.path_transform,'String',''); %show the path to the senlected function |
---|
2336 | end |
---|
2337 | %------------------------------------------------------------------------ |
---|
2338 | % --- generates a series of file names with reference numbers between range1 and |
---|
2339 | % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the |
---|
2340 | % --- image pair. The set of first numbers num1 of the image pairs is also |
---|
2341 | % --- given as output |
---|
2342 | % function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) |
---|
2343 | % %------------------------------------------------------------------------ |
---|
2344 | % [Path,Name]=fileparts(filebase); |
---|
2345 | % filebasesub=fullfile(Path,subdir,Name); |
---|
2346 | % filecell={};%default |
---|
2347 | % num_i1=[]; |
---|
2348 | % num_i2=[]; |
---|
2349 | % num_j1=[]; |
---|
2350 | % num_j2=[]; |
---|
2351 | % ind0_i=first_i:incr_i:last_i; |
---|
2352 | % nbcolumn=length(ind0_i); |
---|
2353 | % ind0_j=first_j:incr_j:last_j; |
---|
2354 | % nbline=length(ind0_j); |
---|
2355 | % if isequal(mode,'#_ab') |
---|
2356 | % dirpair=dir([filebasesub '*_*.nc']); |
---|
2357 | % elseif isequal(mode,'bursts')||isequal(mode,'series(Dj)') |
---|
2358 | % dirpair=dir([filebasesub '_*_*-*.nc']); |
---|
2359 | % elseif isequal(mode,'series(Di)') |
---|
2360 | % dirpair=dir([filebasesub '_*-*_*.nc']); |
---|
2361 | % else |
---|
2362 | % msgbox_uvmat('ERROR','option *|* not yet implemented') |
---|
2363 | % return |
---|
2364 | % end |
---|
2365 | % if isempty(dirpair) |
---|
2366 | % msgbox_uvmat('ERROR','no pair detected in the selected range') |
---|
2367 | % return |
---|
2368 | % end |
---|
2369 | % |
---|
2370 | % if isequal(mode,'bursts')||isequal(mode,'#_ab') |
---|
2371 | % icount=0; |
---|
2372 | % for ifile=1:length(dirpair) |
---|
2373 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2374 | % num1_r=str2num(str_1); |
---|
2375 | % if isequal(RootFile,Name) & ~isempty(num1_r) |
---|
2376 | % num_i1(ifile)=num1_r; |
---|
2377 | % num_a(ifile)=stra2num(str_a); |
---|
2378 | % num_b(ifile)=stra2num(str_b); |
---|
2379 | % end |
---|
2380 | % end |
---|
2381 | % test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range |
---|
2382 | % ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices |
---|
2383 | % select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory |
---|
2384 | % ind_i=ind_i(select);%set of selected indices ind_i |
---|
2385 | % [ind_i,indsort]=sort(ind_i);%sorted list of ind_i |
---|
2386 | % select=select(indsort); |
---|
2387 | % num_i1=num_i1(select); |
---|
2388 | % num_a=num_a(select); |
---|
2389 | % num_b=num_b(select); |
---|
2390 | % dirpair=dirpair(select); |
---|
2391 | % [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn); |
---|
2392 | % ind_i(ind_remove)=[]; |
---|
2393 | % num_a(ind_remove)=[]; |
---|
2394 | % num_b(ind_remove)=[]; |
---|
2395 | % num_j1=zeros(1,nbcolumn);%default |
---|
2396 | % num_j2=num_j1; |
---|
2397 | % num_j1(ind_i)=num_a; |
---|
2398 | % num_j2(ind_i)=num_b; |
---|
2399 | % num_i1=first_i:incr_i:last_i; |
---|
2400 | % num_i2=num_i1; |
---|
2401 | % nbmissing=nbcolumn-length(ind_i); |
---|
2402 | % |
---|
2403 | % elseif isequal(mode,'series(Di)') |
---|
2404 | % %ind0_i=num_first_i:num_incr_i:num_last_i; |
---|
2405 | % %nbcolumn=length(ind0_i); |
---|
2406 | % %ind0_j=num_first_j:num_incr_j:num_last_j; |
---|
2407 | % %nbline=length(ind0_j); |
---|
2408 | % %dirpair=dir([filebasesub '_*-*_*.nc']); |
---|
2409 | % for ifile=1:length(dirpair) |
---|
2410 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2411 | % num_i1_r(ifile)=str2num(str_1); |
---|
2412 | % num_i2_r(ifile)=str2num(str_2); |
---|
2413 | % num_j(ifile)=str2num(str_a); |
---|
2414 | % end |
---|
2415 | % num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files |
---|
2416 | % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range |
---|
2417 | % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices |
---|
2418 | % ind_j=((num_j-first_j)/incr_j)+1; |
---|
2419 | % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices |
---|
2420 | % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory |
---|
2421 | % ind_ij=ind_ij(select);%set of selected indices ind_ij |
---|
2422 | % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij |
---|
2423 | % select=select(indsort); |
---|
2424 | % num_i1_r=num_i1_r(select); |
---|
2425 | % num_i2_r=num_i2_r(select); |
---|
2426 | % dirpair=dirpair(select); |
---|
2427 | % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; |
---|
2428 | % ind_ij(ind_remove)=[]; |
---|
2429 | % num_i1_r(ind_remove)=[]; |
---|
2430 | % num_i2_r(ind_remove)=[]; |
---|
2431 | % num_i1=zeros(1,nbline*nbcolumn);%default |
---|
2432 | % num_i2=num_i1; |
---|
2433 | % num_i1(ind_ij)=num_i1_r; |
---|
2434 | % num_j2(ind_ij)=num_i2_r; |
---|
2435 | % num_i1=reshape(num_i1,nbline,nbcolumn); |
---|
2436 | % num_i2=reshape(num_i2,nbline,nbcolumn); |
---|
2437 | % num_j1=meshgrid(ind0_i,ind0_j); |
---|
2438 | % num_j2=num_j1; |
---|
2439 | % nbmissing=nbline*nbcolumn-length(ind_ij); |
---|
2440 | % elseif isequal(mode,'series(Dj)') |
---|
2441 | % for ifile=1:length(dirpair) |
---|
2442 | % [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); |
---|
2443 | % num_i(ifile)=str2num(str_1); |
---|
2444 | % num_a(ifile)=str2num(str_a); |
---|
2445 | % num_b(ifile)=str2num(str_b); |
---|
2446 | % end |
---|
2447 | % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files |
---|
2448 | % test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range |
---|
2449 | % ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices |
---|
2450 | % ind_j=((num_j-first_j)/incr_j)+1; |
---|
2451 | % ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices |
---|
2452 | % select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory |
---|
2453 | % ind_ij=ind_ij(select);%set of selected indices ind_ij |
---|
2454 | % [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij |
---|
2455 | % select=select(indsort); |
---|
2456 | % num_i=num_i(select); |
---|
2457 | % num_a=num_a(select); |
---|
2458 | % num_b=num_b(select); |
---|
2459 | % dirpair=dirpair(select); |
---|
2460 | % [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; |
---|
2461 | % ind_ij(ind_remove)=[]; |
---|
2462 | % num_a(ind_remove)=[]; |
---|
2463 | % num_b(ind_remove)=[]; |
---|
2464 | % num_j1=zeros(1,nbline*nbcolumn);%default |
---|
2465 | % num_j2=num_j1; |
---|
2466 | % num_j1(ind_ij)=num_a; |
---|
2467 | % num_j2(ind_ij)=num_b; |
---|
2468 | % num_j1=reshape(num_j1,nbline,nbcolumn); |
---|
2469 | % num_j2=reshape(num_j2,nbline,nbcolumn); |
---|
2470 | % num_i1=meshgrid(ind0_i,ind0_j); |
---|
2471 | % num_i2=num_i1; |
---|
2472 | % nbmissing=nbline*nbcolumn-length(ind_ij); |
---|
2473 | % end |
---|