MATLAB Answers


How to edit a particular variable in a netcdf file?

Asked by Angshuman on 15 Jan 2012
Latest activity Edited by John Kelly on 26 Feb 2015
Hi, I am trying to modify a specific variable in a netcdf file. In my file a 4D-variable named MSUL_V(lat,lon,level,time) is there, i want to change the values of this variable at every lat and lon. I am not familiar with editing variables in netcdf package MATLAB.
Please help me about this. I do appreciate if everyone could help me about this. Thanks Angshuman


Sign in to comment.

1 Answer

Answer by Ashish Uthama on 16 Jan 2012
Edited by John Kelly on 26 Feb 2015
 Accepted Answer

You could use the ncwrite function to overwrite the variable.


ya, thank you
But my MATLAB does not support ncwrite...the netcdf package does not have that. Is there any other way....
Yes, but it will need a bit more work. Have a look at this example: (It creates a new file and write a new variable). You will have to code up something similar, i.e open a file in write mode, get the variable ID of your variable and then use putvar to overwrite it.

Sign in to comment.