/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/ncvars.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/ncvars.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Mon Apr 11 20:48:54 2011 UTC (14 years, 3 months ago) by roquet
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65p, checkpoint65q
Changes since 1.1: +12 -4 lines
interface for old/new Matlab netcdf toolbox

1 gforget 1.1 function [vars]=ncvars(ncid);
2     %input: ncid is a netcdf file id
3     %output: vars is the list of its variables name (in cell)
4    
5 roquet 1.2 global useNativeMatlabNetcdf; if isempty(useNativeMatlabNetcdf); useNativeMatlabNetcdf = ~isempty(which('netcdf.open')); end;
6    
7     if useNativeMatlabNetcdf;
8    
9     [numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid);
10     for ii=1:numvars;
11     aa=netcdf.inqVar(ncid,ii-1);
12     if ii==1; vars={aa}; else; vars=[vars aa]; end;
13     end;
14    
15     else;%try to use old mex stuff
16     vars=ncnames(var(ncid));
17 gforget 1.1 end;

  ViewVC Help
Powered by ViewVC 1.1.22