Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
rachael
Posts:
15
Registered:
2/10/09
|
|
problem using netcdf toolbox's "ncsave" with matlab2012
Posted:
Jan 21, 2013 1:58 PM
|
|
Has anyone else run into trouble using netcdf library tools like "ncsave" in the 2012b version of matlab (iOSX Mtn. Lion)?
I understand that the 2012b version of matlab has a built-in library of netcdf tools (http://www.mathworks.com/help/matlab/ref/netcdf.html)--which is great(!)--but I would like to still be able to use "ncsave" for backward compatibility in using code that I created with earlier matlab releases. The problem that I'm running into is that ncsave not only doesn't work but completely overwrites the netcdf file that I'm trying to save to so that the file is not longer recognized as a netcdf and is only KBs in size.
Here is exactly what I did:
1) Copied existing netcdf to new file, "newfile". File size same as orig. (64.9 MB) 2) Read/write netcdf variable "var" to "newfile":
Specific matlab calls and error below ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> ncload('newfile.nc', 'var'); >> ncsave('newfile.nc', 'var'); Overwriting newfile.nc Undefined variable variables.
Error in ncsave (line 10) myvars =evalin('caller',' whos(variables{:}) '); 10 myvars =evalin('caller',' whos(variables{:}) '); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"newfile" size is now 32 bytes
I really liked using ncload and ncsave because it allowed me to load and save multiple variables at once. The new built-ins don't seem to have this functionality.
Does anyone know of a fix for using "ncsave" in 2012b?
Alternatively, I'd settle for a way to either import/export mult. variables using the built-in functions, but I'd rather not have to re-write the functions that use "ncsave".
|
|
|
|