I have installed Matlabstan and I tried to run the ‘‘rats’’ example, and then Matlab returns the error information below:

Having a problem getting stan version.

This is likely a problem with Java running out of file descriptors

Trying again.

Trying again.

Trying again.

Trying again.

Trying again.

Trying again.

Giving up.

Error using cellfun

Non-scalar in Uniform output, at index 1, output 1.

Set ‘UniformOutput’ to false.

Error in StanModel/stan_version (line 851)

ver = cellfun(@str2num,regexp(str{3},’.’,‘split’));

Error in StanModel (line 196)

ver = self.stan_version();

Error in stan (line 108)

model = StanModel();

Error in rats (line 20)

fit = stan(‘file’,‘rats.stan’,‘data’,rats_dat,‘verbose’,true);

I tried the solution suggested by @niklasb in Matlabstan - "Having a problem getting stan version." - #9 by mitzimorris that simply replacing the stan_version() part in StanModel.m with

function ver = stan_version(self)

ver = [2 29 1];

end

However it returns a new error:

rats

Error using StanModel/set.file (line 332)

File does not exist

Error in StanModel/set (line 275)

self.file = p.Results.file;

Error in StanModel/sampling (line 730)

self.set(varargin{:});

Error in stan (line 138)

fit = model.sampling(p.Unmatched);

Error in rats (line 20)

fit = stan(‘file’,‘rats.stan’,‘data’,rats_dat,‘verbose’,true);

I wonder if anybody can help me with this issue. I am using Matlab R2021a the cmdstan version is 2.29.1.