Skip to content
Snippets Groups Projects
Commit aaaf60b2 authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

correct permutation for char array

parent ca429c97
No related branches found
No related tags found
No related merge requests found
......@@ -176,23 +176,39 @@ for id = 0:nvars-1
end
end
% % if var is char and as vertical alignment, transpose it
% % ------------------------------------------------------
% % if xtype == self.NC_CHAR && (size(s.data__, 1) ~= 1)
% % s.data__ = s.data__';
% % end
%
% % add internal dimension__ member
% % Because MATLAB uses FORTRAN-style ordering, however, the order of
% % the dimension IDs is reversed relative to what would be obtained
% % from the C API
% % ----------------------------
% if length(dimids) > 1
% s.data__ = permute(s.data__, fliplr(1:length(dimids)));
% dimids = fliplr(dimids);
% end
% if var is char and as vertical alignment, transpose it
% ------------------------------------------------------
% if xtype == self.NC_CHAR && (size(s.data__, 1) ~= 1)
% s.data__ = s.data__';
% end
if xtype == self.NC_CHAR && (size(s.data__', 1) == 1)
s.data__ = s.data__';
% add internal dimension__ member
% Because MATLAB uses FORTRAN-style ordering, however, the order of
% Because MATLAB uses FORTRAN-style indexing, we need to transpose
% N-D array (k,i,j,...) to (i,j,k,...) however, the order of
% the dimension IDs is reversed relative to what would be obtained
% from the C API
% ----------------------------
if length(dimids) > 1
% If s.data__ is a vector, NetCDF API return vertical vector,
% do nothing, it's OK
% -----------------------------------------------------------------
elseif length(dimids) > 1
s.data__ = permute(s.data__, fliplr(1:length(dimids)));
dimids = fliplr(dimids);
end
for dimid = 1:numel(dimids)
dimname = netcdf.inqDim(self.nc_id, dimids(dimid));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment