Export Netcdf variable to text

4 Ansichten (letzte 30 Tage)
sumant
sumant am 21 Mai 2014
Kommentiert: Ashish Uthama am 22 Mai 2014
Hi, I am a newbie with netcdf files and have been trying to export one of the variables from netcdf .nc format to a text file (ascii etc). I am able to read the netcdf file using ncdump, and get the variable using nc_varget. But when I try saving the variable (which is 4D double), it does not saves a 4D file - instead it saves just the values in that particular variable. The commands I am using are for e.g.
variable = nc_varget('filename.nc','var')
dlmwrite('variable.txt', variable)
can someone help me please? If you have a code which does this can you share it? Thanks
[Edit] Format code. [AU]
  1 Kommentar
Ashish Uthama
Ashish Uthama am 22 Mai 2014
"it does not saves a 4D file - instead it saves just the values in that particular variable. " - could you clarify further? How exactly do you want to save the 4D data in a text file? I believe your code snippet would just write all values of that 4D Netcdf variable as a single stream of values in the text file.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by