- Timestamp:
- 02/25/22 00:11:37 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/contrib/defleurian/netCDF/restable.m
r26871 r26901 15 15 %we save the size of the current step for further treatment 16 16 self.sizes=[self.sizes;fliplr(size(stepvar))]; 17 flatdata=reshape(stepvar, 1, []); 17 %we need to transpose to follow the indexing 18 flatdata=reshape(stepvar', 1, []); 18 19 self.data=[self.data,flatdata]; 19 20 end … … 32 33 findim=[maxsize, rows]; 33 34 %first check if all steps are the same size 34 SameSize = sum(self.sizes - self.sizes(1 ))==0;35 SameSize = sum(self.sizes - self.sizes(1, :))==0; 35 36 if SameSize, 36 37 %same size for all steps, just reshape … … 40 41 startpoint=1; 41 42 datadim=ndims(self.data); 42 outdat= NaN*ones(findim);43 outdat=nan(findim); 43 44 for r=1:rows 44 45 curlen = prod(self.sizes(r, :)); 45 outdat(1:self.sizes(r,1), 1:self.sizes(r,2), r) = reshape(self.data(startpoint:startpoint+curlen-1),self.sizes(r,:)); 46 outdat(1:self.sizes(r,1), 1:self.sizes(r,2), r) = reshape(self.data(startpoint:startpoint+ ... 47 curlen-1),self.sizes(r,:)); 46 48 startpoint = startpoint+curlen; 47 49 end
Note:
See TracChangeset
for help on using the changeset viewer.