


'nc2struct_toolbox': transform a netcdf file in a corresponding matlab structure, USE OLD NETCDF LIBRARY
----------------------------------------------------------------------
function [Data,var_detect,ichoice]=nc2struct_toolbox(nc,ListField)
OUTPUT:
Data: structure containing all the information of the netcdf file (or netcdf object)
with fields:
.ListGlobalAttribute: cell listing the names of the global attributes
.Att_1,Att_2... : values of the global attributes
.ListDimName: cell listing the names of the array dimensions
.DimValue: array dimension values (Matlab vector with the same length as .ListDimName
.ListVarName: cell listing the names of the variables
.VarDimIndex: cell containing the set of dimension indices (in list .ListDimName) for each variable of .ListVarName
.VarDimName: cell containing a cell of dimension names (in list .ListDimName) for each variable of .ListVarName
.VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName
.Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName
var_detect: vector with same length as ListVarName, with 1 for each detected variable and 0 else.
ichoice: = line
INPUT:
nc: name of a netcdf file (char string) or netcdf object
ListField: optional list of variable names to select (cell array of char strings {'VarName1', 'VarName2',...} )
if ListField is absent or ='*', ALL the attributes and variables are read. %
if ListField='ListGlobalAttribute', followed by the arguments 'name1', name2'..., only thes global attributes will be read (short option)
if ListField=[] or{}, no variables is read (only global attributes and lists of vdimensions, variables and attriburtes)
if ListField is a cell array with n lines, the set of variables
will be sought by order of priority in the list, while output names will be set by the first line
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
This file is part of the toolbox UVMAT.
UVMAT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UVMAT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License (file UVMAT/COPYING.txt) for more details.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA