Changeset 450 for trunk/src/uvmat.m
- Timestamp:
- Jun 12, 2012, 12:27:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r446 r450 41 41 % - Information defined from the interface: 42 42 % .NewSeries: =1 when the first view of a new field series is displayed, else 0 43 % . filename:(char string)43 % .FileName:(char string) 44 44 % .FieldName: (char string) main field selected('image', 'velocity'...) 45 45 % .CName: (char string)name of the scalar used for vector colors 46 46 % .MovieObject{1}: movie object representing an input movie 47 47 % .MovieObject{2}: idem for a second input series (_1) 48 % . filename_1 : last second input file name (to deal with a constant second input without reading again the file)48 % .FileName_1 : last second input file name (to deal with a constant second input without reading again the file) 49 49 % .ZMin, .ZMax: range of the z coordinate 50 50 %..... to complement … … 787 787 else 788 788 msgbox_uvmat('WARNING','unable to synchronise the indices of the two series') 789 % set(handles.SubField,'Value',0)790 % SubField_Callback([], [], handles)791 789 end 792 790 end … … 846 844 UvData.j1_series{index}=j1_series; 847 845 UvData.j2_series{index}=j2_series; 848 % set(handles.CheckFixPair,'Value',1) % activate by default the comp_input '-'input window849 846 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 850 847 if index==1 … … 924 921 [XmlData,warntext]=imadoc2struct(filexml); 925 922 if ~isempty(warntext) 926 msgbox_uvmat('WARNING',warntext) 923 display(warntext) 924 % msgbox_uvmat('WARNING',warntext) 927 925 end 928 926 if isfield(XmlData,'TimeUnit') … … 1968 1966 % Field: structure describing an optional input field (then replace the input file) 1969 1967 1970 function errormsg=refresh_field(handles, filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field)1968 function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,Field) 1971 1969 %------------------------------------------------------------------------ 1972 1970 … … 1985 1983 %% determine the main input file information for action 1986 1984 FileType=[];%default 1987 if ~exist( filename,'file')1988 errormsg=['input file ' filename ' does not exist'];1985 if ~exist(FileName,'file') 1986 errormsg=['input file ' FileName ' does not exist']; 1989 1987 return 1990 1988 end … … 2010 2008 ParamIn.ColorVar='';%default variable name for vector color 2011 2009 frame_index=1;%default 2012 if ~isempty(filename) 2013 ObjectName=filename; 2010 if ~isempty(FileName) 2014 2011 FieldName='';%default 2015 2012 VelType='';%default … … 2036 2033 end 2037 2034 case {'video','mmreader'} 2038 ObjectName=UvData.MovieObject{1};2035 ParamIn=UvData.MovieObject{1}; 2039 2036 if ~strcmp(NomType,'*') 2040 2037 frame_index=num_j1;%frame index for movies or multimage … … 2060 2057 ParamIn.VelType=VelType; 2061 2058 ParamIn.GUIName='get_field'; 2062 [Field{1},ParamOut,errormsg] = read_field( ObjectName,UvData.FileType{1},ParamIn,frame_index);2059 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index); 2063 2060 if ~isempty(errormsg) 2064 errormsg=['error in reading ' filename ': ' errormsg];2061 errormsg=['error in reading ' FileName ': ' errormsg]; 2065 2062 return 2066 2063 end … … 2077 2074 end 2078 2075 2079 %% choose and read a second field filename_1 if defined2076 %% choose and read a second field FileName_1 if defined 2080 2077 VelType_1=[];%default 2081 2078 FieldName_1=[]; 2082 2079 ParamOut_1=[]; 2083 2080 frame_index_1=1; 2084 if ~isempty( filename_1)2085 if ~exist( filename_1,'file')2086 errormsg=['second file ' filename_1 ' does not exist'];2081 if ~isempty(FileName_1) 2082 if ~exist(FileName_1,'file') 2083 errormsg=['second file ' FileName_1 ' does not exist']; 2087 2084 return 2088 2085 end 2089 Name= filename_1;2086 Name=FileName_1; 2090 2087 switch UvData.FileType{2} 2091 2088 case {'civx','civdata','netcdf'}; … … 2108 2105 end 2109 2106 case {'video','mmreader'} 2110 Name=UvData.MovieObject{2};2107 ParamIn_1=UvData.MovieObject{2}; 2111 2108 if ~strcmp(NomType_1,'*') 2112 2109 frame_index_1=num_j1;%frame index for movies or multimage … … 2136 2133 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2137 2134 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2138 if isfield(UvData,' filename_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')2139 test_keepdata_1= strcmp( filename_1,UvData.filename_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1);2135 if isfield(UvData,'FileName_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2136 test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1); 2140 2137 end 2141 2138 end … … 2149 2146 [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,frame_index_1); 2150 2147 if ~isempty(errormsg) 2151 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg];2148 errormsg=['error in reading ' FieldName_1 ' in ' FileName_1 ': ' errormsg]; 2152 2149 return 2153 2150 end … … 2195 2192 %% update the display menu for the second velocity type (second menuline) 2196 2193 test_veltype_1=0; 2197 if isempty( filename_1)2194 if isempty(FileName_1) 2198 2195 set(handles.Fields_1,'Value',1); %update the field menu 2199 2196 set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu … … 2339 2336 2340 2337 %% store the current open names, fields and vel types in uvmat interface 2341 UvData. filename_1=filename_1;2338 UvData.FileName_1=FileName_1; 2342 2339 2343 2340 %% apply coordinate transform or other user fct … … 2354 2351 transform=transform_list{choice_value};%selected function handles 2355 2352 % z index 2356 if ~isempty( filename)2353 if ~isempty(FileName) 2357 2354 Field{1}.ZIndex=z_index; 2358 2355 end … … 2722 2719 hget_field=findobj(allchild(0),'name','get_field'); 2723 2720 if isempty(hget_field) 2724 get_field( filename)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)2721 get_field(FileName)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2725 2722 end 2726 2723 errormsg='The field defined by get_field cannot be plotted'; … … 2947 2944 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles); 2948 2945 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 2949 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];2950 % filename=read_file_boxes(handles);2951 [erread,message]=fileattrib( filename);2946 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 2947 %FileName=read_file_boxes(handles); 2948 [erread,message]=fileattrib(FileName); 2952 2949 if ~isempty(message) && ~isequal(message.UserWrite,1) 2953 msgbox_uvmat('ERROR',['no writting access to ' filename])2950 msgbox_uvmat('ERROR',['no writting access to ' FileName]) 2954 2951 return 2955 2952 end … … 2973 2970 hhh=which('netcdf.open');% look for built-in matlab netcdf library 2974 2971 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library 2975 nc=netcdf.open( filename,'NC_WRITE');2972 nc=netcdf.open(FileName,'NC_WRITE'); 2976 2973 netcdf.reDef(nc); 2977 2974 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1); … … 2986 2983 netcdf.close(nc); 2987 2984 else %old netcdf library 2988 netcdf_toolbox( filename,AxeData,attrname,nbname,flagname)2985 netcdf_toolbox(FileName,AxeData,attrname,nbname,flagname) 2989 2986 end 2990 2987 … … 2992 2989 %----Correct the netcdf file, using toolbox (old versions of Matlab). 2993 2990 %------------------------------------------------------------------- 2994 function netcdf_toolbox( filename,AxeData,attrname,nbname,flagname)2995 nc=netcdf( filename,'write'); %open netcdf file2991 function netcdf_toolbox(FileName,AxeData,attrname,nbname,flagname) 2992 nc=netcdf(FileName,'write'); %open netcdf file 2996 2993 result=redef(nc); 2997 2994 eval(['nc.' attrname '=1;']); … … 3090 3087 set(handles.VelType_1,'visible','off') 3091 3088 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3092 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];3093 % filename=read_file_boxes(handles);3089 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3090 %FileName=read_file_boxes(handles); 3094 3091 hget_field=findobj(allchild(0),'name','get_field'); 3095 3092 if ~isempty(hget_field) 3096 3093 delete(hget_field) 3097 3094 end 3098 hget_field=get_field( filename);3095 hget_field=get_field(FileName); 3099 3096 set(hget_field,'Name','get_field') 3100 3097 hhget_field=guidata(hget_field); … … 3147 3144 '*.*', 'All Files (*.*)'}, ... 3148 3145 'Pick a netcdf file',FileBase); 3149 filename=[PathName FileName];3146 FullFileName=[PathName FileName]; 3150 3147 % display the selected field and related information 3151 display_file_name( handles, filename)3148 display_file_name( handles,FullFileName) 3152 3149 return 3153 3150 end … … 3186 3183 UvData=rmfield(UvData,'Field_1');% remove the stored second field (a new one needs to be read) 3187 3184 end 3188 UvData. filename_1='';% desactivate the use of a constant second file3185 UvData.FileName_1='';% desactivate the use of a constant second file 3189 3186 list_fields=get(handles.Fields,'String');% list menu fields 3190 3187 field= list_fields{get(handles.Fields,'Value')}; % selected string … … 3201 3198 %% read the rootfile input display 3202 3199 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 3203 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];3200 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3204 3201 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 3205 3202 % set(handles.FileIndex_1,'Visible','on') … … 3212 3209 delete(hget_field) 3213 3210 end 3214 hget_field=get_field( filename_1);3211 hget_field=get_field(FileName_1); 3215 3212 set(hget_field,'name','get_field_1') 3216 3213 hhget_field=guidata(hget_field); … … 3326 3323 set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic) 3327 3324 UvData=get(handles.uvmat,'UserData'); 3328 %refresh field with a second filename=first file name3325 %refresh field with a second FileName=first file name 3329 3326 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 3330 3327 drawnow 3331 3328 InputFile=read_GUI(handles.InputFile); 3332 3329 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3333 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];3330 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3334 3331 3335 3332 if isempty(InputFile.VelType_1) 3336 filename_1='';% we plot the current field without the second field3333 FileName_1='';% we plot the current field without the second field 3337 3334 set(handles.SubField,'Value',0) 3338 3335 SubField_Callback(hObject, eventdata, handles) 3339 3336 elseif get(handles.SubField,'Value')% if subfield is already 'on' 3340 3337 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 3341 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];3338 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 3342 3339 else 3343 filename_1=filename;% we compare two fields in the same file by default3340 FileName_1=FileName;% we compare two fields in the same file by default 3344 3341 UvData.FileType{2}=UvData.FileType{1}; 3345 3342 set(handles.SubField,'Value',1) … … 3348 3345 UvData=rmfield(UvData,'Field_1');% removes the stored second field if it exists 3349 3346 end 3350 UvData. filename_1='';% desactivate the use of a constant second file3347 UvData.FileName_1='';% desactivate the use of a constant second file 3351 3348 set(handles.uvmat,'UserData',UvData) 3352 3349 num_i1=stra2num(get(handles.i1,'String')); … … 3355 3352 num_j2=stra2num(get(handles.j2,'String')); 3356 3353 3357 errormsg=refresh_field(handles, filename,filename_1,num_i1,num_i2,num_j1,num_j2);3354 errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2); 3358 3355 3359 3356 if ~isempty(errormsg)
Note: See TracChangeset
for help on using the changeset viewer.