Changeset 193
- Timestamp:
- Feb 20, 2011, 10:42:19 AM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_functions.m
r89 r193 47 47 'get_field';...% choose and plot a field from a Netcdf file 48 48 'get_field.fig';...%interface for get_field 49 'get_plot_handles';... %provides handles of elements setting the plotting parameters in the uvmat interface50 49 'griddata_uvmat';...%make 2D linear interpolation using griddata, with input appropriate for both Matlab 6.5 and 7 51 50 'hist_update';...% update of a current global histogram by inclusion of a new field … … 92 91 icount=0; 93 92 % loop on the list of functions in the uvmat package 93 datnum=zeros(1,length(list_fct)); 94 94 for i=1:length(list_fct) 95 95 dir_fct=which(list_fct{i});% path to fct … … 104 104 end 105 105 datfile=dir(dir_fct); 106 date_str=datfile.date;%string of the date of last modification 107 datnum(i)=0;%default 108 try 109 datnum(i)=datenum(date_str); 110 catch 111 datnum(i)=0;%in case of error with datenum (e.g. date in french) 106 if isfield(datfile,'datenum') 107 datnum(i)= datfile.datenum; 112 108 end 109 % date_str=datfile.date;%string of the date of last modification 110 % datnum(i)=0;%default 111 % try 112 % datnum(i)=datenum(date_str); 113 % catch 114 % datnum(i)=0;%in case of error with datenum (e.g. date in french) 115 % end 113 116 end 114 117 end -
trunk/src/get_field.m
r188 r193 812 812 uvmat(inputfile) 813 813 else 814 set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) 814 815 hhuvmat=guidata(huvmat); 815 816 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat … … 835 836 function plot_get_field(SubField,handles) 836 837 %------------------------------------------------------------------------ 837 list_fig=get(handles.list_fig,'String') ;838 list_fig=get(handles.list_fig,'String') 838 839 val=get(handles.list_fig,'Value'); 839 840 if strcmp(list_fig{val},'uvmat') -
trunk/src/mouse_up.m
r192 r193 138 138 % testmask=get(hmask,'Value'); 139 139 % end 140 % if testmask141 % PlotHandles=[];%do not project data on the object during mask creation142 % else143 % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters144 % end145 140 146 141 %% update the object representation … … 153 148 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 154 149 155 %% plot the field projected on the object and store it on the corresponding figure150 %% plot the field projected on the object 156 151 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 157 152 if ~isempty(ProjData) 158 153 if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field 159 % if strcmp(projview,'view_field')160 154 hview_field=findobj(allchild(0),'tag','view_field'); 161 155 if isempty(hview_field) … … 165 159 ViewFieldData.axes3=ProjData; 166 160 set(hview_field,'UserData',ViewFieldData) 167 % PlotHandles=guidata(hview_field);161 hh_plotfield=guidata(hview_field); 168 162 else 169 163 UvData.axes3=ProjData; 170 % PlotHandles=hhuvmat;164 hh_plotfield=hhuvmat; 171 165 end 172 [PlotType,PlotParam]=plot_field(ProjData,hhcurrentfig.axes3,hhcurrentfig);%update an existing field plot 173 write_plot_param(hhcurrentfig,PlotParam); %update the display of plotting parameters for the current object 174 end 175 % if isfield(UvData.Object{IndexObj},'PlotParam') 176 % write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object 177 % end 166 [PlotType,PlotParam]=plot_field(ProjData,hh_plotfield.axes3,read_plot_param(hh_plotfield));%update an existing field plot 167 write_plot_param(hh_plotfield,PlotParam); %update the display of plotting parameters for the current object 168 end 178 169 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 179 170 set(hhuvmat.edit_object,'Value',1);% … … 248 239 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe 249 240 PosRect=CurrentOrigin; 250 xy=get(currentaxes,'CurrentPoint') %xy(1,1),xy(1,2): current x,y positions in axes coordinates241 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 251 242 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)]) 252 243 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)]) -
trunk/src/plot_field.m
r192 r193 134 134 if testnewfig 135 135 hfig=figure; 136 % if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)137 % set(hfig,'UserData',PlotParam)138 % end139 136 set(hfig,'Units','normalized') 140 % set(hfig,'WindowButtonDownFcn','mouse_down')141 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function142 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function143 137 haxes=axes; 144 138 set(haxes,'position',[0.13,0.2,0.775,0.73]) … … 161 155 %% check the cells of fields : 162 156 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data); 163 164 157 if ~isempty(errormsg) 165 158 msgbox_uvmat('ERROR',['input of plot_field/find_field_indices: ' errormsg]); … … 202 195 errormsg=[]; 203 196 AxeData=get(haxes,'UserData'); 197 if isempty(index_2D) 198 plot_plane([],[],[],haxes);%removes images or vector plots if any 199 else 200 [xx,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar); 201 AxeData.NbDim=2; 202 if testzoomaxes && isempty(errormsg) 203 [zoomaxes,PlotParamOut,xx,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar); 204 AxeData.ZoomAxes=zoomaxes; 205 end 206 %remove coordinates variables from 1D plot 207 for ivar=1:length(index_1D) 208 if isequal(CellVarIndex{index_1D(ivar)},VarType{index_1D(ivar)}.coord) 209 index_1D(ivar)=0; 210 end 211 end 212 index_1D=find(index_1D); 213 end 214 204 215 if isempty(index_1D) 205 216 plot_profile([],[],[],haxes);% … … 211 222 end 212 223 PlotType='line'; 213 end214 215 if isempty(index_2D)216 plot_plane([],[],[],haxes);%removes images or vector plots if any217 else218 [xx,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar);219 AxeData.NbDim=2;220 if testzoomaxes && isempty(errormsg)221 [zoomaxes,PlotParamOut,xx,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar);222 AxeData.ZoomAxes=zoomaxes;223 end224 224 end 225 225 htext=findobj(hfig,'Tag','text_display'); … … 374 374 else 375 375 coord_x_index_cell=VarType{icell}.coord(1); 376 376 if isequal(coord_x_index_cell,0) 377 377 continue % the cell has no abscissa, skip it 378 end 379 % if ~isempty(coord_x_index)&&~isequal(coord_x_index_cell,coord_x_index) 380 % %continue %all the selected variables must have the same first dimension 381 % else 382 % coord_x_index=coord_x_index_cell; 383 % end 384 coord_x_index=coord_x_index_cell; 378 end 379 coord_x_index=coord_x_index_cell; 385 380 end 386 381 testplot=ones(size(data.ListVarName));%default test for plotted variables … … 393 388 end 394 389 eval(['coord_x{icell}=data.' data.ListVarName{coord_x_index} ';']);%coordinate variable set as coord_x 390 XMin(icell)=min(coord_x{icell}); 391 XMax(icell)=max(coord_x{icell}); 395 392 testplot(coord_x_index)=0; 396 393 if ~isempty(VarType{icell}.ancillary') … … 425 422 end 426 423 eval(['data.' VarName '=squeeze(data.' VarName ');']) 424 eval(['YMin(ivar)=min(data.' VarName ');']) 425 eval(['YMax(ivar)=max(data.' VarName ');']) 427 426 plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ',']; 428 427 eval(['nbcomponent2=size(data.' VarName ',2);']); … … 431 430 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1); 432 431 end 433 %eval(['varmean=mean(double(data.' VarName '));']);%mean value434 %textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];435 432 if nbcomponent1==1|| nbcomponent2==1 436 433 legend_str=[legend_str {VarName}]; %variable with one component … … 442 439 end 443 440 end 441 YMin_cell(icell)=min(YMin); 442 YMax_cell(icell)=max(YMax); 444 443 end 445 444 … … 447 446 if test_newplot && ~isequal(plotstr,'hhh=plot(') 448 447 set(hfig,'CurrentAxes',haxes) 449 tag=get(haxes,'tag'); 450 448 tag=get(haxes,'tag'); 451 449 %%% 452 450 plotstr=[plotstr '''tag'',''plot_line'');']; 453 451 eval(plotstr) %execute plot (instruction plotstr) 454 452 %%% 455 456 453 set(haxes,'tag',tag) 457 454 grid(haxes, 'on') … … 499 496 end 500 497 498 %% determine axes bounds 499 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits; 500 if fix_lim 501 if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY') 502 fix_lim=0; %free limits if lits are not set, 503 end %else PlotParamOut.XMin =PlotParam.XMin... 504 end 505 if ~fix_lim 506 PlotParamOut.MinX=min(XMin); 507 PlotParamOut.MaxX=max(XMax); 508 PlotParamOut.MinY=min(YMin_cell); 509 PlotParamOut.MaxY=max(YMax_cell); 510 end 501 511 502 512 %------------------------------------------------------------------- … … 521 531 hcol=findobj(hfig,'Tag','Colorbar'); %look for colorbar axes 522 532 hima=findobj(haxes,'Tag','ima');% search existing image in the current axes 523 errormsg= [];%default533 errormsg='';%default 524 534 test_ima=0; %default: test for image or map plot 525 535 test_vec=0; %default: test for vector plots … … 661 671 end 662 672 if test_interp_X 663 npxy( 1)=max([256 floor((AX(end)-AX(1))/DAX_min) floor((AX(end)-AX(1))/DAX_max)]);673 npxy(2)=max([256 floor((AX(end)-AX(1))/DAX_min) floor((AX(end)-AX(1))/DAX_max)]); 664 674 xI=linspace(AX(1),AX(end),npxy(2)); 665 675 if ~test_interp_Y … … 1033 1043 1034 1044 %store the coordinate extrema occupied by the field 1035 Data1036 1045 if ~isempty(Data) 1037 1046 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits; … … 1041 1050 end %else PlotParamOut.XMin =PlotParam.XMin... 1042 1051 end 1043 'TESTfix'1044 fix_lim1045 1052 if ~fix_lim 1046 1053 XMin=[]; … … 1110 1117 rot=alpha*[cos(theta) -sin(theta); sin(theta) cos(theta)]'; 1111 1118 %find the existing lines 1112 %h=findobj(gca,'Type','Line');% search existing lines in the current axes1113 1119 h=findobj(haxes,'Tag','vel');% search existing lines in the current axes 1114 1120 sizh=size(h); 1115 1121 set(h,'EraseMode','xor'); 1116 1122 set(haxes,'NextPlot','replacechildren'); 1117 1123 1118 1124 %drawnow 1119 1125 %create lines (if no lines) or modify them … … 1125 1131 1126 1132 for icolor=1:ncolor 1127 %determine the line positions for each color icolor 1133 %determine the line positions for each color icolor 1128 1134 ind=find(col_vec==icolor); 1129 1135 xc=x(ind); … … 1134 1140 xN=NaN*ones(size(xc)); 1135 1141 matx=[xc(:)-uc(:)/2 xc(:)+uc(:)/2 xN(:)]'; 1136 % matx=[xc(:) xc(:)+uc(:) xN(:)]';1142 % matx=[xc(:) xc(:)+uc(:) xN(:)]'; 1137 1143 matx=reshape(matx,1,3*n(2)); 1138 1144 maty=[yc(:)-vc(:)/2 yc(:)+vc(:)/2 xN(:)]'; 1139 % maty=[yc(:) yc(:)+vc(:) xN(:)]';1145 % maty=[yc(:) yc(:)+vc(:) xN(:)]'; 1140 1146 maty=reshape(maty,1,3*n(2)); 1141 1147 … … 1149 1155 y2=yc+vc/2; 1150 1156 y3=yc+vc/2-arrowmoins(2,:); 1151 % x1=xc+uc-arrowplus(1,:);1152 % x2=xc+uc;1153 % x3=xc+uc-arrowmoins(1,:);1154 % y1=yc+vc-arrowplus(2,:);1155 % y2=yc+vc;1156 % y3=yc+vc-arrowmoins(2,:);1157 1157 matxar=[x1(:) x2(:) x3(:) xN(:)]'; 1158 1158 matxar=reshape(matxar,1,4*n(2)); … … 1160 1160 matyar=reshape(matyar,1,4*n(2)); 1161 1161 %draw the line or modify the existing ones 1162 % hx = [x1;x2;x3]; 1163 % hy = [y1;y2;y3]; 1164 tri=reshape(1:3*length(uc),3,[])'; 1165 %d = tri(:,[1 2 3 1])'; 1166 1162 tri=reshape(1:3*length(uc),3,[])'; 1167 1163 isn=isnan(colorlist(icolor,:));%test if color NaN 1168 1164 if 2*icolor > sizh(1) %if icolor exceeds the number of existing ones 1169 %axes(haxes)1170 % hfig=get(haxes,'parent');1171 % axes(haxes)1172 % set(0,'CurrentFigure',hfig)1173 % set(hfig,'CurrentAxes',haxes)1174 1165 if ~isn(1) %if the vectors are visible color not nan 1175 1166 if n(2)>0 … … 1177 1168 line(matx,maty,'Color',colorlist(icolor,:),'Tag','vel');% plot new lines 1178 1169 line(matxar,matyar,'Color',colorlist(icolor,:),'Tag','vel');% plot arrows 1179 % fill(hx(d),hy(d),colorlist(icolor,:),'EdgeColor','none',' 1180 % Tag','Vel'); 1181 end 1170 end 1182 1171 end 1183 1172 else 1184 if isn(1) 1173 if isn(1) 1185 1174 delete(h(2*icolor-1)) 1186 1175 delete(h(2*icolor)) … … 1193 1182 set(h(2*icolor),'EraseMode','xor'); 1194 1183 end 1195 1184 end 1196 1185 end 1197 1186 if sizh(1) > 2*ncolor -
trunk/src/proj_field.m
r187 r193 2050 2050 ICOMB=(XIMA-1)*DimValue(1)+YIMA; 2051 2051 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 2052 vec_B(ind_in, [1:nbcolor])=vec_A(ICOMB,:);2052 vec_B(ind_in,1:nbcolor)=vec_A(ICOMB,:); 2053 2053 for icolor=1:nbcolor 2054 2054 vec_B(ind_out,icolor)=zeros(size(ind_out)); -
trunk/src/set_object.m
r187 r193 703 703 testnew=0; 704 704 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 705 PlotHandles=get_plot_handles(hhuvmat);706 projview='view_field';%default707 705 if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 708 706 IndexObj=IndexObj_1; 709 707 projview='uvmat'; 710 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field711 708 elseif ~isempty(IndexObj_2) && IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 712 709 IndexObj=IndexObj_2; 710 projview='view_field'; 713 711 else %new object 714 712 testnew=1; 715 713 IndexObj=numel(ListObject)+1; 716 hview_field=findobj(allchild(0),'tag','view_field'); 717 if ~isempty(hview_field) 718 PlotHandles=guidata(hview_field); 719 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 720 end 714 projview='view_field'; 721 715 end 722 716 if strcmp(projview,'view_field') … … 728 722 PlotHandles=guidata(hview_field); 729 723 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 724 else 725 PlotHandles=hhuvmat; 726 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 730 727 end 731 732 728 733 729 %% naming the object … … 780 776 %% plot the field projected on the object and store in the corresponding figue 781 777 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 782 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot 778 PlotParam=read_plot_param(PlotHandles); 779 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 783 780 784 781 %% update the GUI uvmat -
trunk/src/uvmat.m
r192 r193 201 201 function uvmat_OpeningFcn(hObject, eventdata, handles, input ) 202 202 %------------------------------------------------------------------------ 203 global nb_builtin 204 205 % Choose default command menuline output for uvmat 203 204 %% Choose default command menuline output for uvmat (standard GUI) 206 205 handles.output = hObject; 207 206 208 % Update handles structure207 %% Update handles structure (standard GUI) 209 208 guidata(hObject, handles); 210 209 211 % set the position of colorbar and ancillary GUIs:210 %% set the position of colorbar and ancillary GUIs: 212 211 set(hObject,'Units','Normalized') 213 212 movegui(hObject,'center') … … 223 222 set(handles.axes3,'UserData',AxeData) 224 223 225 % functions for the mouse and keyboard224 %% set functions for the mouse and keyboard 226 225 set(handles.histo_u,'NextPlot','replacechildren'); 227 226 set(handles.histo_v,'NextPlot','replacechildren'); … … 232 231 set(hObject,'DeleteFcn',{@closefcn})% 233 232 234 % refresh projection plane235 UvData.Object{1}.Style='plane';%main plotting plane233 %% refresh projection plane 234 %UvData.Object{1}.Style='plane';%main plotting plane 236 235 UvData.Object{1}.ProjMode='projection';%main plotting plane 237 236 if ~isfield(UvData.Object{1},'plotaxes') 238 237 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 239 238 set(handles.list_object_1,'Value',1); 240 set(handles.list_object_1,'String',{'1-PLANE'}); 239 % set(handles.list_object_1,'String',{'1-PLANE'}); 240 set(handles.list_object_1,'String',{''}); 241 241 end 242 242 set(handles.Fields,'Value',1) 243 set(handles.Fields,'string',{''}) %TODO: PUT IN THE GUI244 245 % TRANSFORM menu: builtin fcts243 set(handles.Fields,'string',{''}) 244 245 %% TRANSFORM menu: builtin fcts 246 246 menu_str={'';'phys';'px';'phys_polar'}; 247 nb_builtin=numel(menu_str); %number of functions247 UvData.OpenParam.NbBuiltin=numel(menu_str); %number of functions 248 248 path_uvmat=fileparts(which('uvmat')); 249 249 addpath(fullfile(path_uvmat,'transform_field')) … … 261 261 rmpath(fullfile(path_uvmat,'transform_field')) 262 262 263 % load the list of previously browsed files in menus Open and Open_1263 %% load the list of previously browsed files in menus Open and Open_1 264 264 dir_perso=prefdir; % path to the directory .matlab for personal data 265 265 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab … … 291 291 [path,file]=fileparts(h.transform_fct{ilist}); 292 292 addpath(path) 293 % if exist(file,'file')294 293 h_func=str2func(file); 295 294 rmpath(path) … … 311 310 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 312 311 set(handles.uvmat,'UserData',UvData) 313 %set(handles.FixEqual,'Value',1)% by default: axes free to adapt in aspect ratio 314 %set(handles.FixEqual,'BackgroundColor',[1 1 0]) 315 316 %check the path and date of modification of all functions in uvmat 312 313 %% check the path and date of modification of all functions in uvmat 317 314 path_to_uvmat=which ('uvmat');% check the path detected for source file uvmat 318 315 [errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m 319 316 date_str=['last modification: ' date_str]; 320 %case of an input argument for uvmat 317 318 %% case of an input argument for uvmat 321 319 testinputfield=0; 322 320 inputfile=[]; … … 349 347 end 350 348 if ~isempty(inputfile) 349 %%%%% display the indput field %%%%%%% 351 350 display_file_name(hObject, eventdata, handles,inputfile) 351 %%%%%%% 352 352 testinputfield=1; 353 353 end … … 366 366 end 367 367 end 368 % UvData.NewSeries=1; 369 set(handles.uvmat,'UserData',UvData) 368 % set(handles.uvmat,'UserData',UvData) 369 370 %% plot input field if exists 370 371 if testinputfield 371 372 %delete drawn objects … … 604 605 set(handles.list_object_1,'Visible','on') 605 606 set(handles.frame_object,'Visible','on') 606 % initiate input file:607 %%%%%% initiate input file: 607 608 update_rootinfo(hObject,eventdata,handles); 608 609 otherwise … … 743 744 XmlData.GeometryCalib 744 745 if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y') 745 'TESTvol'746 746 set (handles.nb_slice,'String','volume') 747 747 end … … 872 872 873 873 if testima 874 % set(handles.Fields,'Value',1) % set menu to 'image'875 % set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})876 874 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 877 875 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); … … 901 899 end 902 900 903 % set index navigation options and refresh plots901 %% set index navigation options and refresh plots 904 902 set(handles.RootPath,'BackgroundColor',[1 1 1]) 905 903 drawnow … … 923 921 NomTypeRaw=regexprep(NomType(2:end), '-', ''); 924 922 if numel(regexp(NomTypeRaw,'\D'))>=1 925 % case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab','#A','%01dA','%02dA','%03dA','%04dA'},% two navigation indices926 923 state_j='on'; 927 924 if isequal(nbfield,1) … … 932 929 NomTypeRaw=regexprep(NomType_1(2:end), '-', ''); 933 930 if numel(regexp(NomTypeRaw,'\D'))>=1 934 % switch NomType_1935 % case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices936 931 state_j='on'; 937 932 if isequal(nbfield,1) … … 954 949 set(handles.j_text,'Visible',state_j); 955 950 956 % view the field951 %% view the field 957 952 run0_Callback(hObject, eventdata, handles); %view field 958 953 mask_test=get(handles.mask_test,'value'); … … 1169 1164 set(handles.FileExt_1,'String',FileExt_1); 1170 1165 1171 % default choice of fields1172 if isequal(ext_test,'.image')1173 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1174 % set(handles.Fields_1,'Value',2) % set menu to 'image'1175 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')1176 Data=nc2struct(fileinput_1,[]);1177 % if isfield(Data,'absolut_time_T0')1178 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1179 % set(handles.Fields_1,'Value',4) % set menu to 'velocity'1180 % else1181 % set(handles.Fields_1,'Value',2) % set menu to 'get_field...'1182 % set(handles.Fields_1,'String',{'';'get_field...'});1183 % end1184 end1166 % % default choice of fields 1167 % if isequal(ext_test,'.image') 1168 % % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1169 % % set(handles.Fields_1,'Value',2) % set menu to 'image' 1170 % elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf') 1171 % Data=nc2struct(fileinput_1,[]); 1172 % % if isfield(Data,'absolut_time_T0') 1173 % % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1174 % % set(handles.Fields_1,'Value',4) % set menu to 'velocity' 1175 % % else 1176 % % set(handles.Fields_1,'Value',2) % set menu to 'get_field...' 1177 % % set(handles.Fields_1,'String',{'';'get_field...'}); 1178 % % end 1179 % end 1185 1180 set(handles.SubField,'Visible','on') 1186 1181 set(handles.SubField,'Value',1) … … 2405 2400 eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors) 2406 2401 test_x=1;%test for unstructured coordinates 2407 else %structured coordinate 2408 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2402 elseif VarType{imax}.coord(NbDim)>0 %structured coordinate 2409 2403 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2404 if NbDim>1 2405 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2406 end 2410 2407 end 2411 2408 if NbDim==3 … … 2419 2416 end 2420 2417 end 2418 if exist('XName','var') 2421 2419 eval(['XMax=max(UvData.Field.' XName ');']) 2422 2420 eval(['XMin=min(UvData.Field.' XName ');']) 2423 eval(['YMax=max(UvData.Field.' YName ');']) 2424 eval(['YMin=min(UvData.Field.' YName ');']) 2421 UvData.Field.NbDim=NbDim; 2422 UvData.Field.XMax=XMax; 2423 UvData.Field.XMin=XMin; 2424 if NbDim >1 2425 eval(['YMax=max(UvData.Field.' YName ');']) 2426 eval(['YMin=min(UvData.Field.' YName ');']) 2427 UvData.Field.YMax=YMax; 2428 UvData.Field.YMin=YMin; 2429 end 2425 2430 eval(['nbvec=length(UvData.Field.' XName ');']) 2426 2431 if test_x %unstructured coordinates … … 2434 2439 VarIndex=CellVarIndex{imax}; % list of variable indices 2435 2440 DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2436 nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1));2437 2441 nbpoints_x=UvData.Field.DimValue(DimIndex(NbDim)); 2438 2442 DX=(XMax-XMin)/(nbpoints_x-1); 2439 DY=(YMax-YMin)/(nbpoints_y-1); 2443 if NbDim >1 2444 nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1)); 2445 DY=(YMax-YMin)/(nbpoints_y-1); 2446 end 2440 2447 if NbDim==3 2441 2448 nbpoints_z=UvData.Field.DimValue(DimIndex(1)); … … 2448 2455 end 2449 2456 end 2450 UvData.Field.NbDim=NbDim; 2451 UvData.Field.XMax=XMax; 2452 UvData.Field.XMin=XMin; 2453 UvData.Field.YMax=YMax; 2454 UvData.Field.YMin=YMin; 2455 2457 end 2456 2458 2457 2459 %% 3D case (menuvolume) … … 2511 2513 else 2512 2514 % create a default projection menuplane 2513 UvData.Object{1}.Style='plane';%main plotting plane2515 %UvData.Object{1}.Style='none';%main plotting plane 2514 2516 UvData.Object{1}.ProjMode='projection';%main plotting plane 2515 2517 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2516 2518 set(handles.list_object_1,'Value',1); 2517 set(handles.list_object_1,'String',{' 1-PLANE'});2519 set(handles.list_object_1,'String',{''}); 2518 2520 end 2519 2521 if ~isfield(UvData.Object{1},'plotaxes') … … 2553 2555 haxes(2)=plot_handles{2}.axes3; 2554 2556 PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the uvmat interface 2555 keeplim(2)=get(plot_handles{2}.Fix edLimits,'Value');2557 keeplim(2)=get(plot_handles{2}.FixLimits,'Value'); 2556 2558 PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field 2557 2559 end … … 2829 2831 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library 2830 2832 nc=netcdf.open(filename,'NC_WRITE'); 2831 netcdf.reDef(nc) 2832 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1) 2833 netcdf.reDef(nc); 2834 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1); 2833 2835 dimid = netcdf.inqDimID(nc,nbname); 2834 2836 try … … 2837 2839 varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist 2838 2840 end 2839 netcdf.endDef(nc) 2841 netcdf.endDef(nc); 2840 2842 netcdf.putVar(nc,varid,UvData.axes3.FF); 2841 netcdf.close(nc) 2843 netcdf.close(nc); 2842 2844 else %old netcdf library 2843 2845 netcdf_toolbox(filename,AxeData,attrname,nbname,flagname) … … 3819 3821 function transform_fct_Callback(hObject, eventdata, handles) 3820 3822 %------------------------------------------------------------- 3821 global nb_builtin 3822 3823 huvmat=get(handles.transform_fct,'parent'); 3823 3824 UvData=get(handles.uvmat,'UserData'); 3824 3825 menu=get(handles.transform_fct,'String'); 3825 3826 ind_coord=get(handles.transform_fct,'Value'); … … 3859 3860 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 3860 3861 if exist(profil_perso,'file') 3862 nb_builtin=UvData.OpenParam.NbBuiltin; 3861 3863 for ilist=nb_builtin+1:numel(list_transform) 3862 3864 ff=functions(list_transform{ilist}); … … 3877 3879 set(handles.FixLimits,'Value',0) 3878 3880 set(handles.FixLimits,'BackgroundColor',[0.7 0.7 0.7]) 3879 3880 UvData=get(huvmat,'UserData');3881 3881 3882 3882 %delete drawn objects … … 3911 3911 UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 3912 3912 end 3913 set(h uvmat,'UserData',UvData)3913 set(handles.uvmat,'UserData',UvData) 3914 3914 run0_Callback(hObject, eventdata, handles) 3915 3915 … … 4179 4179 colcode.colcode2=str2num(get(handles.colcode2,'String')); 4180 4180 end 4181 % colcode.option=get(handles.vec_col_bar,'Value');4182 4181 colcode.FixedCbounds=0; 4183 % list_code=get(handles.col_vec,'String');% list menu fields4184 % index_code=get(handles.col_vec,'Value');% selected string index4185 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color4186 4182 colcode.FixedCbounds=1; 4187 4183 vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max … … 4203 4199 UvData=get(handles.uvmat,'UserData'); 4204 4200 AxeData=UvData.axes3; 4205 'TESTupdateplot' 4206 PlotParam=read_plot_param(handles) 4207 PlotParam.Vectors 4201 PlotParam=read_plot_param(handles); 4208 4202 [PP,PlotParamOut]= plot_field(AxeData,haxes,PlotParam); 4209 'TESTOUT'4210 PlotParamOut4211 4203 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4212 4204 … … 4214 4206 % --- Executes on button press in grid. 4215 4207 function grid_Callback(hObject, eventdata, handles) 4216 4217 4208 4218 4209 -
trunk/src/view_field.m
r192 r193 266 266 267 267 %------------------------------------------------------------------- 268 % --- Executes on button press in 'Fix edLimits'.269 %------------------------------------------------------------------- 270 function Fix edLimits_Callback(hObject, eventdata, handles)271 test=get(handles.Fix edLimits,'Value');268 % --- Executes on button press in 'FixLimits'. 269 %------------------------------------------------------------------- 270 function FixLimits_Callback(hObject, eventdata, handles) 271 test=get(handles.FixLimits,'Value'); 272 272 if test 273 set(handles.Fix edLimits,'BackgroundColor',[1 1 0])273 set(handles.FixLimits,'BackgroundColor',[1 1 0]) 274 274 else 275 set(handles.Fix edLimits,'BackgroundColor',[0.7 0.7 0.7])276 end 277 278 %------------------------------------------------------------------- 279 % --- Executes on button press in auto_xy.280 function auto_xy_Callback(hObject, eventdata, handles)281 test=get(handles. auto_xy,'Value');275 set(handles.FixLimits,'BackgroundColor',[0.7 0.7 0.7]) 276 end 277 278 %------------------------------------------------------------------- 279 % --- Executes on button press in FixEqual. 280 function FixEqual_Callback(hObject, eventdata, handles) 281 test=get(handles.FixEqual,'Value'); 282 282 if test 283 set(handles. auto_xy,'BackgroundColor',[1 1 0])283 set(handles.FixEqual,'BackgroundColor',[1 1 0]) 284 284 cla(handles.axes3) 285 285 update_plot(handles) 286 286 else 287 set(handles. auto_xy,'BackgroundColor',[0.7 0.7 0.7])287 set(handles.FixEqual,'BackgroundColor',[0.7 0.7 0.7]) 288 288 update_plot(handles) 289 289 end … … 298 298 if (get(handles.zoom,'Value') == 1); 299 299 set(handles.zoom,'BackgroundColor',[1 1 0]) 300 set(handles.Fix edLimits,'Value',1)% propose by default fixed limits for the plotting axes301 set(handles.Fix edLimits,'BackgroundColor',[1 1 0])300 set(handles.FixLimits,'Value',1)% propose by default fixed limits for the plotting axes 301 set(handles.FixLimits,'BackgroundColor',[1 1 0]) 302 302 else 303 303 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) … … 532 532 function MinA_Callback(hObject, eventdata, handles) 533 533 %------------------------------------------ 534 set(handles. AutoScal,'Value',1) %suppress auto mode535 set(handles. AutoScal,'BackgroundColor',[1 1 0])534 set(handles.FixScal,'Value',1) %suppress auto mode 535 set(handles.FixScal,'BackgroundColor',[1 1 0]) 536 536 update_plot(handles) 537 537 … … 539 539 function MaxA_Callback(hObject, eventdata, handles) 540 540 %-------------------------------------------- 541 set(handles. AutoScal,'Value',1) %suppress auto mode542 set(handles. AutoScal,'BackgroundColor',[1 1 0])541 set(handles.FixScal,'Value',1) %suppress auto mode 542 set(handles.FixScal,'BackgroundColor',[1 1 0]) 543 543 update_plot(handles) 544 544 545 545 %----------------------------------------------- 546 function AutoScal_Callback(hObject, eventdata, handles)546 function FixScal_Callback(hObject, eventdata, handles) 547 547 %-------------------------------------------- 548 test=get(handles. AutoScal,'Value');548 test=get(handles.FixScal,'Value'); 549 549 if test 550 set(handles. AutoScal,'BackgroundColor',[1 1 0])550 set(handles.FixScal,'BackgroundColor',[1 1 0]) 551 551 else 552 set(handles. AutoScal,'BackgroundColor',[0.7 0.7 0.7])552 set(handles.FixScal,'BackgroundColor',[0.7 0.7 0.7]) 553 553 update_plot(handles); 554 554 % set(handles.MinA,'String',num2str(ScalOut.MinA,3)) … … 592 592 function VecScale_Callback(hObject, eventdata, handles) 593 593 %------------------------------------------------------------------- 594 set(handles. AutoVec,'Value',1);595 set(handles. AutoVec,'BackgroundColor',[1 1 0])596 update_plot(handles) 597 598 %------------------------------------------------------------------- 599 function AutoVec_Callback(hObject, eventdata, handles)600 %------------------------------------------------------------------- 601 test=get(handles. AutoVec,'Value');594 set(handles.FixVec,'Value',1); 595 set(handles.FixVec,'BackgroundColor',[1 1 0]) 596 update_plot(handles) 597 598 %------------------------------------------------------------------- 599 function FixVec_Callback(hObject, eventdata, handles) 600 %------------------------------------------------------------------- 601 test=get(handles.FixVec,'Value'); 602 602 if test 603 set(handles. AutoVec,'BackgroundColor',[1 1 0])603 set(handles.FixVec,'BackgroundColor',[1 1 0]) 604 604 else 605 605 update_plot(handles); 606 606 %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3)) 607 set(handles. AutoVec,'BackgroundColor',[0.7 0.7 0.7])607 set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7]) 608 608 end 609 609 … … 819 819 820 820 821 822 823 824 function MinX_Callback(hObject, eventdata, handles) 825 % hObject handle to MinX (see GCBO) 826 % eventdata reserved - to be defined in a future version of MATLAB 827 % handles structure with handles and user data (see GUIDATA) 828 829 % Hints: get(hObject,'String') returns contents of MinX as text 830 % str2double(get(hObject,'String')) returns contents of MinX as a double 831 832 833 % --- Executes during object creation, after setting all properties. 834 function MinX_CreateFcn(hObject, eventdata, handles) 835 % hObject handle to MinX (see GCBO) 836 % eventdata reserved - to be defined in a future version of MATLAB 837 % handles empty - handles not created until after all CreateFcns called 838 839 % Hint: edit controls usually have a white background on Windows. 840 % See ISPC and COMPUTER. 841 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 842 set(hObject,'BackgroundColor','white'); 843 end 844 845 846 847 function MaxX_Callback(hObject, eventdata, handles) 848 % hObject handle to MaxX (see GCBO) 849 % eventdata reserved - to be defined in a future version of MATLAB 850 % handles structure with handles and user data (see GUIDATA) 851 852 % Hints: get(hObject,'String') returns contents of MaxX as text 853 % str2double(get(hObject,'String')) returns contents of MaxX as a double 854 855 856 % --- Executes during object creation, after setting all properties. 857 function MaxX_CreateFcn(hObject, eventdata, handles) 858 % hObject handle to MaxX (see GCBO) 859 % eventdata reserved - to be defined in a future version of MATLAB 860 % handles empty - handles not created until after all CreateFcns called 861 862 % Hint: edit controls usually have a white background on Windows. 863 % See ISPC and COMPUTER. 864 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 865 set(hObject,'BackgroundColor','white'); 866 end 867 868 869 870 function MinY_Callback(hObject, eventdata, handles) 871 % hObject handle to MinY (see GCBO) 872 % eventdata reserved - to be defined in a future version of MATLAB 873 % handles structure with handles and user data (see GUIDATA) 874 875 % Hints: get(hObject,'String') returns contents of MinY as text 876 % str2double(get(hObject,'String')) returns contents of MinY as a double 877 878 879 % --- Executes during object creation, after setting all properties. 880 function MinY_CreateFcn(hObject, eventdata, handles) 881 % hObject handle to MinY (see GCBO) 882 % eventdata reserved - to be defined in a future version of MATLAB 883 % handles empty - handles not created until after all CreateFcns called 884 885 % Hint: edit controls usually have a white background on Windows. 886 % See ISPC and COMPUTER. 887 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 888 set(hObject,'BackgroundColor','white'); 889 end 890 891 892 893 function MaxY_Callback(hObject, eventdata, handles) 894 % hObject handle to MaxY (see GCBO) 895 % eventdata reserved - to be defined in a future version of MATLAB 896 % handles structure with handles and user data (see GUIDATA) 897 898 % Hints: get(hObject,'String') returns contents of MaxY as text 899 % str2double(get(hObject,'String')) returns contents of MaxY as a double 900 901 902 % --- Executes during object creation, after setting all properties. 903 function MaxY_CreateFcn(hObject, eventdata, handles) 904 % hObject handle to MaxY (see GCBO) 905 % eventdata reserved - to be defined in a future version of MATLAB 906 % handles empty - handles not created until after all CreateFcns called 907 908 % Hint: edit controls usually have a white background on Windows. 909 % See ISPC and COMPUTER. 910 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 911 set(hObject,'BackgroundColor','white'); 912 end 913 914 -
trunk/src/write_plot_param.m
r192 r193 1 1 %'write_plot_param': update the plotting parameters on the uvmat interface after a plotting operation 2 2 function write_plot_param(handles,PlotParam) 3 'TESTwrite'4 PlotParam5 3 %coordinates 6 4 if isfield(PlotParam,'FixEqual') … … 13 11 end 14 12 end 13 if isfield(PlotParam,'MinX') 15 14 set(handles.MinX,'String',num2str(PlotParam.MinX,4)); 16 15 set(handles.MaxX,'String',num2str(PlotParam.MaxX,4)); 17 16 set(handles.MinY,'String',num2str(PlotParam.MinY,4)); 18 17 set(handles.MaxY,'String',num2str(PlotParam.MaxY,4)); 18 else 19 set(handles.MinX,'String',''); 20 set(handles.MaxX,'String',''); 21 set(handles.MinY,'String',''); 22 set(handles.MaxY,'String',''); 23 end 19 24 20 25 %scalar or image parameters … … 91 96 set(handles.min_title,'Visible',state) 92 97 set(handles.max_title,'Visible',state) 93 set(handles.frame_scal,'Visible',state)98 %set(handles.frame_scal,'Visible',state) 94 99 set(handles.npx,'Visible',state) 95 100 set(handles.npy,'Visible',state)
Note: See TracChangeset
for help on using the changeset viewer.