I am trying to create a .nc file and with the following script as my example:
% Intialise file
nc=netcdf('my_file.nc','clobber');
% Define DIMS
ncdim('LATS',length(Y),nc);
ncdim('LONS',length(X),nc);
ncvar('LATS','double',{'LATS'},nc);
nc{'LATS'}(:) = Y';
Doing this i get the error:
??? Error: File: /home/matlab/toolbox/netcdf/@ncvar/subsasgn.m Line: 118 Column: 9 "subs" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable. A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using load or eval.
Error in ==> netcdf.subsasgn at 83 result = subsasgn(v, s, other);
Any help?? I cannot seem to assign values to variable that I am trying to create.
Best Answer