Changeset 227 for trunk/src/uvmat.m
- Timestamp:
- Mar 31, 2011, 1:42:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r221 r227 232 232 233 233 %% refresh projection plane 234 %UvData.Object{1}.Style='plane';%main plotting plane235 234 UvData.Object{1}.ProjMode='projection';%main plotting plane 236 % if ~isfield(UvData.Object{1},'plotaxes')237 % UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis238 % set(handles.list_object_1,'Value',1);239 % % set(handles.list_object_1,'String',{'1-PLANE'});240 % set(handles.list_object_1,'String',{''});241 % end242 235 set(handles.Fields,'Value',1) 243 236 set(handles.Fields,'string',{''}) … … 331 324 inputfile=input.InputFile; 332 325 end 333 Field=input; 326 if isfield(Field,'TimeIndex') 327 set(handles.i1,num2str(Field.TimeIndex)) 328 end 334 329 elseif ischar(input)% file name introduced as input 335 330 inputfile=input; … … 347 342 end 348 343 if ~isempty(inputfile) 349 %%%%% display the in dput field %%%%%%%344 %%%%% display the input field %%%%%%% 350 345 display_file_name(hObject, eventdata, handles,inputfile) 351 346 %%%%%%% … … 366 361 end 367 362 end 368 % set(handles.uvmat,'UserData',UvData)369 363 370 364 %% plot input field if exists … … 437 431 '*.*', 'All Files (*.*)'}, ... 438 432 'Pick a file',oldfile); 439 %global filebase440 433 fileinput=[PathName FileName];%complete file name 441 % testblank=findstr(fileinput,' ');%look for blanks442 % if ~isempty(testblank)443 % msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])444 % return445 % end446 434 sizf=size(fileinput); 447 435 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end … … 484 472 % --- Open again the file whose name has been recorded in MenuFile_1 485 473 function MenuFile_1_Callback(hObject, eventdata, handles) 474 %------------------------------------------------------------------------ 486 475 fileinput=get(handles.MenuFile_1,'Label'); 487 476 display_file_name(hObject, eventdata, handles,fileinput) … … 490 479 % --- Open again the file whose name has been recorded in MenuFile_2 491 480 function MenuFile_2_Callback(hObject, eventdata, handles) 481 %------------------------------------------------------------------------ 492 482 fileinput=get(handles.MenuFile_2,'Label'); 493 483 display_file_name(hObject, eventdata, handles,fileinput) … … 496 486 % --- Open again the file whose name has been recorded in MenuFile_3 497 487 function MenuFile_3_Callback(hObject, eventdata, handles) 488 %------------------------------------------------------------------------ 498 489 fileinput=get(handles.MenuFile_3,'Label'); 499 490 display_file_name(hObject, eventdata, handles,fileinput) … … 502 493 % --- Open again the file whose name has been recorded in MenuFile_4 503 494 function MenuFile_4_Callback(hObject, eventdata, handles) 495 %------------------------------------------------------------------------ 504 496 fileinput=get(handles.MenuFile_4,'Label'); 505 497 display_file_name(hObject, eventdata, handles,fileinput) … … 508 500 % --- Open again the file whose name has been recorded in MenuFile_5 509 501 function MenuFile_5_Callback(hObject, eventdata, handles) 502 %------------------------------------------------------------------------ 510 503 fileinput=get(handles.MenuFile_5,'Label'); 511 504 display_file_name(hObject, eventdata, handles,fileinput) … … 514 507 % --- Fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput' 515 508 function display_file_name(hObject, eventdata, handles,fileinput) 509 %------------------------------------------------------------------------ 516 510 if ~exist(fileinput,'file') 517 511 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) … … 871 865 % set default options in menu 'Fields' 872 866 873 if testima 874 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 875 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); 876 %col_vec=get(handles.col_vec,'String'); 877 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx 878 FieldList=calc_field; 879 set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 880 set(handles.Fields,'Value',2) % set menu to 'velocity' 881 col_vec=FieldList; 882 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 883 else %general netcdf file (not civx) 884 set(handles.Fields,'Value',1) % set menu to 'get_field... 885 set(handles.Fields,'String',{'get_field...'}) 886 col_vec={'get_field...'}; 887 hget_field=findobj('Name','get_field'); 888 if ~isempty(hget_field)%delete any existing get_field GUI for reinitialisation withthe new file series 889 hhget_field=guidata(hget_field); 890 if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input 891 delete(hget_field) 892 end 893 end 894 end 895 set(handles.col_vec,'String',col_vec) 896 else 897 msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 898 return 899 end 867 if ~testima 868 testcivx=0; 869 hget_field=findobj('Name','get_field'); 870 % if isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 871 if isempty(hget_field) 872 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); 873 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx 874 FieldList=calc_field; 875 set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 876 set(handles.Fields,'Value',2) % set menu to 'velocity' 877 col_vec=FieldList; 878 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 879 testcivx=1; 880 end 881 else 882 hhget_field=guidata(hget_field); 883 if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input 884 delete(hget_field) 885 end 886 end 887 if ~testcivx 888 set(handles.Fields,'Value',1) % set menu to 'get_field... 889 set(handles.Fields,'String',{'get_field...'}) 890 col_vec={'get_field...'}; 891 end 892 set(handles.col_vec,'String',col_vec) 893 % else 894 % msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) 895 % return 896 % end 897 end 900 898 901 899 %% set index navigation options and refresh plots … … 1391 1389 set(handles.scan_i,'Value',0) 1392 1390 set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784]) 1393 NomType=get(handles.FileIndex,'UserData') 1391 NomType=get(handles.FileIndex,'UserData'); 1394 1392 switch NomType 1395 1393 case {'_i_j1-j2','#_ab','%3dab'},% pair with j index … … 2047 2045 num_j1=stra2num(get(handles.j1,'String')); 2048 2046 num_j2=stra2num(get(handles.j2,'String')); 2047 2049 2048 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2); 2049 2050 2050 if ~isempty(errormsg) 2051 2051 msgbox_uvmat('ERROR',errormsg); … … 2167 2167 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface 2168 2168 set(handles.npy,'String',num2str(ParamOut.Npy)); 2169 end 2170 if isfield(ParamOut,'TimeIndex') 2171 set(handles.i1,'String',num2str(ParamOut.TimeIndex)) 2172 end 2173 if isfield(ParamOut,'TimeValue') 2174 Field{1}.Time=ParamOut.TimeValue; 2169 2175 end 2170 2176 end … … 2434 2440 end 2435 2441 if exist('XName','var') 2436 eval(['XMax=max( UvData.Field.' XName ');'])2437 eval(['XMin=min( UvData.Field.' XName ');'])2442 eval(['XMax=max(max(UvData.Field.' XName '));']) 2443 eval(['XMin=min(min(UvData.Field.' XName '));']) 2438 2444 UvData.Field.NbDim=NbDim; 2439 2445 UvData.Field.XMax=XMax; 2440 2446 UvData.Field.XMin=XMin; 2441 2447 if NbDim >1 2442 eval(['YMax=max( UvData.Field.' YName ');'])2443 eval(['YMin=min( UvData.Field.' YName ');'])2448 eval(['YMax=max(max(UvData.Field.' YName '));']) 2449 eval(['YMin=min(min(UvData.Field.' YName '));']) 2444 2450 UvData.Field.YMax=YMax; 2445 2451 UvData.Field.YMin=YMin; … … 3256 3262 % transform netc type to the corresponding image type 3257 3263 % set(handles.FileExt_1,'String','.png'); 3258 if isequal(NomType_1,'_i1-i2_j')| isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2')3264 if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2')|| isequal(NomType_1,'#_ab')|| isequal(NomType_1,'_i1-i2') 3259 3265 UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory 3260 3266 % set(handles.SubDir_1,'String','') 3261 3267 % set(handles.FileExt_1,'String','.png'); 3262 if isequal(NomType_1,'_i1-i2_j')| isequal(NomType_1,'_i_j1-j2')3268 if isequal(NomType_1,'_i1-i2_j')||isequal(NomType_1,'_i_j1-j2') 3263 3269 NomTypeNew='_i_j'; 3264 3270 elseif isequal(NomType_1,'#_ab') … … 4079 4085 set(handles.FixScal,'Value',1) %suppress auto mode 4080 4086 set(handles.FixScal,'BackgroundColor',[1 1 0]) 4087 MinA=str2double(get(handles.MinA,'String')); 4088 MaxA=str2double(get(handles.MaxA,'String')); 4089 if MinA>MaxA% switch minA and maxA in case of error 4090 MinA_old=MinA; 4091 MinA=MaxA; 4092 MaxA=MinA_old; 4093 set(handles.MinA,'String',num2str(MinA,5)); 4094 set(handles.MaxA,'String',num2str(MaxA,5)); 4095 end 4081 4096 update_plot(handles); 4082 4097 … … 4086 4101 set(handles.FixScal,'Value',1) %suppress auto mode 4087 4102 set(handles.FixScal,'BackgroundColor',[1 1 0]) 4103 MinA=str2double(get(handles.MinA,'String')); 4104 MaxA=str2double(get(handles.MaxA,'String')); 4105 if MinA>MaxA% switch minA and maxA in case of error 4106 MinA_old=MinA; 4107 MinA=MaxA; 4108 MaxA=MinA_old; 4109 set(handles.MinA,'String',num2str(MinA,5)); 4110 set(handles.MaxA,'String',num2str(MaxA,5)); 4111 end 4088 4112 update_plot(handles); 4089 4113
Note: See TracChangeset
for help on using the changeset viewer.