I’m using croco1.3 with a recent version matlab (R2023b), but when I do “make_grid”, it appears “error using ncmex”, with the older version of matlab like R2018a it didn´t appear this error.
I also had the same error and took me a long time to fix it.
Solution: Edit the following file in croco_tools:
croco_tools/UTILITIES/mexcdf/netcdf_toolbox/netcdf/ncutility/ncmex.m
Around line number 123, if(eval(v1)) > 4, etc., comment out that entire if condition block and replace it with the following:
fcn=‘mexnc’
save and exit.
This has to do with the matlab version’s compatibility with netcdf, but I was able to run it after this change. All the best!
I just found a solution* that has the advantage that it could be integrated into future versions of croco_tools and should work on any version of Matlab. That consists of adding 2 lines to the involved conditional, which finally would looks like this:
Blockquote
% Mex-file gateway.
v = version;
if eval(v(1)) > 4
fcn = ‘mexcdf53’; % Matlab-5 or 6.
elseif eval(v(1)) == 4
fcn = ‘mexcdf4’; % Matlab-4 only.
elseif eval(v(1:2)) >20
fcn = ‘mexcdf60’; %Matlab-2020 or later.
else
error(’ ## Unrecognized Matlab version.')
end