From: Paul Alexander on
I'm trying to write a new variable to an existing netcdf file using existing dimensions.
I open and put the netcdf file in define mode; then I:

status=mexnc('def_var',ncidg,'region_mask','double',2,[dimid_xi_rho dimid_eta_rho])
where dimid_xi_rho=2 and dimid_eta_rho=1
-OR-
status=mexnc('def_var',ncidg,'region_mask','double',2,[2 1])
However when it writes it only lists xi_rho as a dimension when I use either of these two commands. I need it to write to the netcdf file showing both dimensions (xi_rho and eta_rho). Any thoughts?
From: Paul Alexander on
I figured out what was wrong. I defined it wrong the first time I executed it so it will forever remain with only one dimension. Which brings me to my next question. Can I delete variables from a netcdf file using matlab?