Help resolving a NetCDF autoscale error in make_grid.m when using MATLAB R2018b

Hello CROCO community,

I’m encountering an error while running the make_grid.m script to generate the grid file. The error message is:

NetCDF file not opened: /home/andredjedje/croco/configs/Run01/CROCO_FILES/croco_grd.nc

Undefined function ‘autoscale’ for input arguments of type ‘double’.

Error in netcdf/subsasgn (line 81)
v = autoscale(v, theAutoscaleflag);

Error in make_grid (line 127)
nc{‘lon_v’}(:)=Lonv;

I’m using MATLAB R2018b on Ubuntu (WSL). I believe the issue is caused by using the older NetCDF toolbox (mexnc or Charles Denham’s), which conflicts with MATLAB’s native NetCDF functions.

Should I replace all nc{} syntax in the CROCO tools (like make_grid.m) with the native MATLAB functions such as nccreate, ncwrite, and ncread? Or is there an updated version of make_grid.m that is compatible with modern MATLAB versions?

Thanks in advance for your help!

– André