Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
aaaf60b2
Commit
aaaf60b2
authored
15 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
correct permutation for char array
parent
ca429c97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
@netcdf_native/private/read.m
+24
-8
24 additions, 8 deletions
@netcdf_native/private/read.m
with
24 additions
and
8 deletions
@netcdf_native/private/read.m
+
24
−
8
View file @
aaaf60b2
...
...
@@ -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
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment