This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden
>From: Danika Gilbert <address@hidden>
>Subject: Re: 20031001: subject
>Organization: UCAR/RAP
>Keywords: 200310101531.h9AFVrOb004507
Hi Danika,
> I'm working on a project within RAP (Juneau Airport Warning System) and
> need to convert our netcdf data files into csv format.  I've been doing
> this in a sort of "thuggish" manner (in Matlab) and was hoping to find an
> easier way to do this.
> 
> Do you have any suggestions or examples of matlab code to do this?
Some possibilities include:
 - Use the ncdump utility.  There is an ncdump option (-v vars) that
   lets you specify a particular variable or a list of variables.  It
   outputs a comma-separated list of values for the specified
   variable, but also some extra header information to make it valid
   CDL.  You may be able to strip off the header information with some
   extra editing utility, such as sed, awk, or perl.
 - Use the nc2txt utility that is part of the netCDF FAN utilities:
    http://www.unidata.ucar.edu/packages/netcdf/fan_utils.html
   from
    http://www.unidata.ucar.edu/packages/netcdf/software.html#FAN
 - Use the contributed "fanmat" package:
    Phil Miller's MATLAB interface to the FAN library for extracting
    and manipulating array data from netCDF files. It includes two MEX
    functions, nc2mat and mat2nc, that are simple gateway functions to
    the FAN library and are MEX file equivalents to the FAN utilities
    nc2text and text2nc.
   from
    ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/fanmat.taz
By the way, it's better to send netCDF support questions to
address@hidden, so they get routed to someone who can
answer them even if I happen to be out of the office, as I was this
time.
--Russ
_____________________________________________________________________
Russ Rew                                         UCAR Unidata Program
address@hidden          http://www.unidata.ucar.edu/staff/russ