Changeset 158 for trunk/src/check_field_structure.m
- Timestamp:
- Dec 22, 2010, 5:12:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_field_structure.m
r140 r158 50 50 nbdim=0; 51 51 Data.ListDimName={}; 52 53 %% main loop on the list of variables 52 54 for ivar=1:nbfield 53 55 VarName=Data.ListVarName{ivar}; … … 64 66 return 65 67 end 66 nbcoord=numel(sizvar);%nbre of coordiantes for variable named VarName 68 nbcoord=numel(sizvar);%nbre of coordinates for variable named VarName 69 testrange=0; 67 70 if numel(DimCell)==0 68 71 errormsg=['empty declared dimension .VarDimName{' num2str(ivar) '} for ' VarName]; … … 79 82 return 80 83 end 84 if sizvar(1)==2 && isequal(VarName,DimCell{1}) 85 testrange=1;% test for a dimension variable representing a range 86 end 81 87 else 82 88 errormsg=['1 dimension declared in .VarDimName{' num2str(ivar) '} inconsistent with the nbre of dimensions =' num2str(nbcoord) ' of the variable ' VarName]; … … 85 91 else 86 92 if numel(DimCell)>nbcoord 87 DimCell=DimCell(end-nbcoord+1:end);%first singleton diem nsions omitted,93 DimCell=DimCell(end-nbcoord+1:end);%first singleton diemensions omitted, 88 94 elseif nbcoord > numel(DimCell) 89 95 errormsg=['nbre of declared dimensions in .VarDimName{' num2str(ivar) '} smaller than the nbre of dimensions =' num2str(nbcoord) ' of the variable ' VarName]; … … 97 103 if isempty(iprev)% append the dimension name to the current list 98 104 nbdim=nbdim+1; 105 RangeTest(nbdim)=0; %default 99 106 if sizvar(idim)==2 && strcmp(DimName,VarName)%case of a coordinate defined by the two end values (regular spacing) 100 107 RangeTest(nbdim)=1; %to be updated for a later variable … … 105 112 else % DimName is detected in the current list of dimension names 106 113 if ~isequal(Data.DimValue(iprev),sizvar(idim)) 114 RangeTest(iprev) 115 Data.DimValue(iprev) 107 116 if isequal(Data.DimValue(iprev),2)&& RangeTest(iprev) % the dimension has been already detected as a range [min max] 108 117 Data.DimValue(iprev)=sizvar(idim); %update with actual value 109 else 118 elseif ~testrange 110 119 errormsg=['dimension declaration inconsistent with the size =[' num2str(sizvar) '] for ' VarName]; 111 120 return
Note: See TracChangeset
for help on using the changeset viewer.