Changeset 681 for trunk/src/read_field.m
 Timestamp:
 Sep 2, 2013, 2:42:52 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/read_field.m
r675 r681 71 71 Role={}; 72 72 ProjModeRequest={}; 73 checkU=0; 74 checkV=0; 73 75 for ilist=1:numel(InputField) 74 76 r=regexp(InputField{ilist},'(?<Operator>(^vec^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 77 Operator=''; 75 78 if isempty(r)% no operator used 76 ListVar=[ListVar InputField(ilist)]; 79 if isempty(find(strcmp(InputField{ilist},ListVar))) 80 ListVar=[ListVar InputField(ilist)];%append the variable name if not already in the list 81 end 77 82 if check_colorvar(ilist) 78 83 Role{numel(ListVar)}='ancillary';% not projected with interpolation … … 83 88 end 84 89 else % an operator 'vec' or 'norm' is used 90 Operator=r.Operator; 85 91 if ~check_colorvar(ilist) && strcmp(r.Operator,'norm') 86 92 ProjModeRequestVar='interp_lin';%scalar field (requires interpolation for plot) … … 94 100 Role=[Role {'vector_x'}]; 95 101 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 102 else 103 checkU=1; 96 104 end 97 105 if isempty(ind_var_V) … … 99 107 Role=[Role {'vector_y'}]; 100 108 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 109 else 110 checkV=1; 101 111 end 102 112 end … … 125 135 Field.VarAttribute{ivar+2}.ProjModeRequest=ProjModeRequest{ivar}; 126 136 end 127 137 if strcmp(Operator,'norm') 138 NormName='norm'; 139 if ~isempty(strcmp(ListVar,'norm')) 140 NormName='norm_1'; 141 end 142 Field.ListVarName=[Field.ListVarName {NormName}]; 143 ilist=numel(Field.ListVarName); 144 Field.VarDimName{ilist}=Field.VarDimName{ind_var_U}; 145 Field.VarDimName{ilist}.Role='scalar'; 146 Field.(NormName)=Field.(r.UName).*Field.(r.UName)+Field.(r.VName).*Field.(r.VName); 147 Field.(NormName)=sqrt(Field.(NormName)); 148 if ~checkU && ~checkV 149 Field.ListVarName([ind_var_U ind_var_V])=[]; 150 Field.VarDimName([ind_var_U ind_var_V])=[]; 151 Field.VarAttribute([ind_var_U ind_var_V])=[]; 152 elseif ~checkU 153 Field.ListVarName(ind_var_U)=[]; 154 Field.VarDimName(ind_var_U)=[]; 155 Field.VarAttribute(ind_var_U )=[]; 156 elseif ~checkV 157 Field.ListVarName(ind_var_V)=[]; 158 Field.VarDimName(ind_var_V)=[]; 159 Field.VarAttribute(ind_var_V )=[]; 160 end 161 end 128 162 case 'video' 129 163 if strcmp(class(ParamIn),'VideoReader')
Note: See TracChangeset
for help on using the changeset viewer.