Changeset 32 for trunk/src/read_get_field.m
- Timestamp:
- Mar 3, 2010, 1:47:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_get_field.m
r19 r32 1 %'read_get_field': read the list of selected variables from the GUI get_field (SAME AS THE FIRST 1 %'read_get_field': read the list of selected variables from the GUI get_field 2 3 % OUTPUT: 4 % SubField: structure with fields 5 % .ListVarName: list of selected variables 6 % .VarDimName: cells with the corresponding dimension names 7 % .Field1, 2...: if an input file has been opened by get_field 8 % errormsg: error message (=[] when no error) 9 2 10 % INPUT: 3 11 % hget_field: handles of the GUI get_field … … 34 42 dim_vec_z=0; 35 43 c_index=[]; 44 45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 46 % ordinary (1D) plot 36 47 if test_1Dplot 37 48 % select ordinate variable(s) 38 49 inputlist=get(handles.ordinate,'String'); 39 50 val=get(handles.ordinate,'Value');% selection(s) for ordinate … … 42 53 VarIndex_y(ilist)=name2index(VarNameCell{ilist},Field.ListVarName);%index of the variable in ListVarName 43 54 dim_ordinate{ilist}=Field.VarDimName{VarIndex_y(ilist)};% name of the corresponding dimension 44 % if iscell(dim_ordinate{ilist})45 % dim_ordinate{ilist}=dim_ordinate{ilist}{1};%take the first dimension name (char chain) in case of a matrix46 % end47 55 testpermute(ilist)=0;%default 48 56 nbvar=nbvar+1; … … 56 64 end 57 65 58 66 % select abscissa variable 59 67 inputlist=get(handles.abscissa,'String'); 60 68 val=get(handles.abscissa,'Value');% a single selection is expected for abscissa … … 95 103 end 96 104 end 97 98 105 test3D=strcmp(get(handles.coord_z_scalar,'Visible'),'on')||strcmp(get(handles.coord_z_vectors,'Visible'),'on'); 99 106 VarSubIndexA=[]; 100 107 101 %scalar variable 108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 109 %scalar field 102 110 test_xdimvar=0;%default 103 111 test_ydimvar=0;%default … … 233 241 end 234 242 end 243 244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 245 % vectors 235 246 test_vec_x_dimvar=0;%default 236 247 test_vec_y_dimvar=0;%default … … 278 289 SubVarAttribute{nbvar}=VarAttribute{VarIndexV}; 279 290 end 280 SubVarAttribute{nbvar}.Role='vector_y'; 281 291 SubVarAttribute{nbvar}.Role='vector_y'; 282 292 283 293 % select x variable for vector 284 294 inputlist=get(handles.coord_x_vectors,'String'); 285 295 val=get(handles.coord_x_vectors,'Value');% a single selection is expected for abscissa … … 287 297 VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName 288 298 if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar 289 % coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity290 299 empty_coord_vec_x=1; 291 300 else … … 315 324 end 316 325 317 326 % select y variable for vector 318 327 inputlist=get(handles.coord_y_vectors,'String'); 319 328 val=get(handles.coord_y_vectors,'Value');% a single selection is expected for abscissa … … 321 330 VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName 322 331 if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar 323 % coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity324 332 empty_coord_vec_y=1; 325 333 else … … 383 391 end 384 392 end 385 386 387 if test3D % (a revoir) 393 394 if test3D % (a revoir) 388 395 %scalar w variable 389 396 inputlist=get(handles.vector_z,'String'); … … 428 435 end 429 436 end 437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 430 438 431 439 % get the input field … … 434 442 SubField=nc2struct(inputfield,ListVarName); 435 443 else % subfield stored in memory 444 SubField.ListGlobalAttribute={}; 436 445 SubField.ListVarName=ListVarName; 437 446 SubField.VarDimName=VarDimName; … … 441 450 SubField.VarAttribute=SubVarAttribute; 442 451 443 %permute indices if coord_y is not the first matrix index 452 %permute indices if coord_y is not the first matrix index: scalar case 444 453 if test_scalar 445 454 VarNameA=Field.ListVarName{VarIndexA}; … … 560 569 end 561 570 562 %permute indices if coord_y is not the first matrix index 571 %permute indices if coord_y is not the first matrix index: vector case 563 572 if test_vector 564 573 VarNameU=Field.ListVarName{VarIndexU}; 565 DimCellU=Field.VarDimName{VarIndexU} ;566 eval(['npxy=size(SubField.' VarNameU ')']) 574 DimCellU=Field.VarDimName{VarIndexU} % list of dimensions for u component 575 eval(['npxy=size(SubField.' VarNameU ')']) % npxy= dimension values for the u component 567 576 SingleCellU={}; 568 577 if numel(npxy) < numel(DimCellU)
Note: See TracChangeset
for help on using the changeset viewer.