


'nc2struct': transform a netcdf file in a corresponding matlab structure
it reads all the global attributes and all variables, or a selected list.
The corresponding dimensions and variable attributes are then extracted
%%%%% TODO: add the possibility to read only attributes, see nc2struct_toolbox %%%
----------------------------------------------------------------------
function [Data,var_detect,ichoice]=nc2struct(nc,ListVarName)
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
ListVarName: optional list of variable names to select (cell array of char strings {'VarName1', 'VarName2',...} )
if ListVarName=[] or {}, no variables is read (only global attributes and lists of dimensions, variables and attriburtes)
if ListVarName is absent, or = '*', ALL the variables are read.
if ListVarName 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