Matlabstan Error Getting Stan Version

Except the compilation issue of the rats.stan I copied from the ‘Example’ folder, could anybody please help me with the issue of running rats.m? I first run it without typing the cmdstan version number in StanModel.m manually and it had such problem:

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 then 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

And it returns

>> rats
Error using StanModel/set.file (line 333)
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 don’t know why the stan function used in rats.m does not create a rats.stan file here.