Changeset 389 for trunk/src/plot_field.m
- Timestamp:
- Apr 8, 2012, 11:11:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r388 r389 156 156 set(htext,'String',{''}) 157 157 else 158 [errormsg]=plot_text(Data,CellVarIndex(index_0D), htext);158 [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext); 159 159 end 160 160 haxes=[]; … … 244 244 set(htext,'String',{''}) 245 245 else 246 [errormsg]=plot_text(Data,CellVarIndex(index_0D), htext);246 [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext); 247 247 end 248 248 end … … 276 276 277 277 %------------------------------------------------------------------- 278 function errormsg=plot_text(FieldData,CellVarIndex, htext)278 function errormsg=plot_text(FieldData,CellVarIndex,VarTypeCell,htext) 279 279 %------------------------------------------------------------------- 280 280 errormsg=[]; … … 283 283 VarIndex=CellVarIndex{icell};% indices of the selected variables in the list data.ListVarName 284 284 for ivar=1:length(VarIndex) 285 VarName=FieldData.ListVarName{VarIndex(ivar)}; 286 VarValue=FieldData.(VarName); 287 if size(VarValue,1)~=1 288 VarValue=VarValue'; 289 end 290 txt=[VarName '=' num2str(VarValue)]; 291 txt_cell=[txt_cell;{txt}]; 285 checkancillary=0; 286 if length(FieldData.VarAttribute)>=VarIndex(ivar) 287 VarAttribute=FieldData.VarAttribute{VarIndex(ivar)}; 288 if isfield(VarAttribute,'Role')&&strcmp(VarAttribute.Role,'ancillary') 289 checkancillary=1; 290 end 291 end 292 if ~checkancillary% does not display variables with attribute '.Role=ancillary' 293 VarName=FieldData.ListVarName{VarIndex(ivar)}; 294 VarValue=FieldData.(VarName); 295 if size(VarValue,1)~=1 296 VarValue=VarValue'; 297 end 298 txt=[VarName '=' num2str(VarValue)]; 299 txt_cell=[txt_cell;{txt}]; 300 end 292 301 end 293 302 end … … 1178 1187 siz2=1; 1179 1188 while siz2<2 1180 % values=[-9:div:9];1181 1189 values=-10:div:10; 1182 1190 ind=find((ord*values-MaxA)<0 & (ord*values-MinA)>0);%indices of 'values' such that MinA<ord*values<MaxA … … 1187 1195 end 1188 1196 siz2=size(ind,2); 1189 % siz2=siz(2)1190 1197 div=div/10; 1191 1198 end … … 1193 1200 end 1194 1201 1195 %'proj_grid': project fields with unstructured coordinantes on a regular grid1196 1202 % ------------------------------------------------------------------------- 1197 % function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in) 1198 1199 1203 % --- 'proj_grid': project fields with unstructured coordinantes on a regular grid 1200 1204 function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in) 1205 % ------------------------------------------------------------------------- 1201 1206 if length(vec_Y)<2 1202 1207 msgbox_uvmat('ERROR','less than 2 points in proj_grid.m'); … … 1212 1217 rangx=rgx_in; % first and last positions 1213 1218 rangy=rgy_in; 1214 % npxy=npxy_in;1215 1219 dxy(1)=1/(npxy_in(1)-1);%grid mesh in y 1216 1220 dxy(2)=1/(npxy_in(2)-1);%grid mesh in x … … 1227 1231 xi=[rangx(1):dxy(2):rangx(2)]; 1228 1232 yi=[rangy(1):dxy(1):rangy(2)]; 1229 [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates1230 1233 A=griddata_uvmat(vec_X,vec_Y,vec_A,xi,yi'); 1231 1234 A=reshape(A,length(yi),length(xi)); … … 1235 1238 ymax=vec_Y(indexend+1);% y coordinate AFTER line change 1236 1239 ymin=vec_Y(index(1)); 1237 %y=[vec_Y(index) ymax]; % the set of y ordinates including the last one1238 1240 y=vec_Y(index); 1239 1241 y(length(y)+1)=ymax; … … 1252 1254 else 1253 1255 rangx=[vec_X(1) vec_X(nx)];% first and last position found for x 1254 % rangy=[ymin ymax];1255 1256 rangy=[max(ymax,ymin) min(ymax,ymin)]; 1256 1257 if max(nx,ny) <= 64 & isequal(npxy_in,'np>256') … … 1272 1273 else %no interpolation for a resolution higher than 256 1273 1274 A=B; 1274 XI=X; 1275 YI=Y; 1276 end 1277 end 1275 end 1276 end
Note: See TracChangeset
for help on using the changeset viewer.