MATLAB: Undefined function ‘matlabpool’ for input arguments of type ‘char’.

matlab char

When I run restplus with matlab2012a or matlab2014a, matlab displays error.

Best Answer

If you encounter that issue on R2012a, then the difficulty would be that you do not have the Parallel Computing Toolbox installed (or perhaps that it is not licensed.)
If you encounter the issue on R2013b or later, then you might potentially have PCT installed and licensed, but you might be encountering the difficulty that as of R2013b, matlabpool() was renamed to parpool(), which takes slightly different options.
I wrote a transition routine to make it easier to deal with code that uses matlabpool in R2013b and later. I wrote it for use with one particular third party software package that only needed a subset of the possible matlabpool inputs, so it is not a complete replacement for matlabpool: it only handles a small number of common inputs. You could try adding this transition code as matlabpool.m and seeing if it works for you. If you start getting messages about gcp or parpool not existing then your problem is with not having PCT installed or licensed.
function varargout = matlabpool(varargin)
%matlabpool shim for R2013b and later, limited functionality
%written July 2018, by Canada Eat The Cookie Foundation
if nargin == 1 && ischar(varargin{1}) && strcmp(varargin{1}, 'size')
pool = gcp('nocreate');
if isempty(pool)
varargout{1} = 0;
else
varargout{1} = pool.NumWorkers;
end
elseif nargin == 1 && isnumeric(varargin{1})
pool = gcp('nocreate');
if ~isempty(pool)
if pool.NumWorkers ~= varargin{1}
delete(pool);
end
pool = parpool(varargin{1});
else
pool = parpool(varargin{1});
end
varargout{1} = pool;
elseif nargin == 1 && ischar(varargin{1}) && strcmp(varargin{1}, 'open')
pool = gcp();
varargout{1} = pool;
else
[varargout{:}] = parpool(varargin{:});
end