Apply Parallel Computing to Simbiology

4 views (last 30 days)
Hello guys,
Please bare with my naive, if I ask something silly. It is my first time try to use the parallel computing.
Beacuse my model in Simbiology is quite complicated, I am trying to use parallel computing toolbox to speed up my model fitting.
However, I got this error and I could not eliminate it... I don't know if my code is wrong completely or I misunderstand the application of the parallel computing toolbox or it is able to be fixed.
Here is my code.
% Estimate Parameters
EstimationFunction = {'lsqnonlin', 'fmincon', 'fminunc'};
parfor i = 1:length(EstimationFunction)
fitConst = sbiofit(model,gData,responseMap,estimatedParams,dose, string(EstimationFunction(i)),[],variants,...
% Plot Results
s = struct;
s.Labels.XLabel = 'Time (hour)';
s.Labels.YLabel = 'Concentration (microgram/milliliter)';
fitProp = sbiofit(model,gData,responseMap,estimatedParams,dose,string(EstimationFunction(i)),[],variants,...
% Plot Results
fitExp = sbiofit(model,gData,responseMap,estimatedParams,dose,string(EstimationFunction(i)),[],variants,...
% Plot Results
fitComb = sbiofit(model,gData,responseMap,estimatedParams,dose,string(EstimationFunction(i)),[],variants,...
% Plot Results
% Information Criteria for Model Selection
allResults = [fitConst,fitProp,fitExp,fitComb];
ErrorModelNames = {'constant error model','proportional error model','exponential error model',...
'combined error model'};
LogLikelihood = [allResults.LogLikelihood]';
AIC = [allResults.AIC]';
BIC = [allResults.BIC]';
t1 = table(LogLikelihood,AIC,BIC);
t1.Properties.RowNames = ErrorModelNames;
Here is the error I got.
Error using
Cannot set WindowStyle to 'docked' when MATLAB is started with no display or when the -noFigureWindows option is specified.
Error in
Error in
Error in (line 770)
Error in (line 169)
[obj, cleanupDashboard] = obj.initializeLivePlotsController(); %#ok<ASGLU>
Error in sbiofit (line 298)
[varargout{1:nargout}] =, data, responseMap, estimInfo, varargin{:});
Error in runfitdoxdata20200223model (line 131)
parfor i = 1:length(EstimationFunction)
Please give me any suggestion or advice. Thank you very much.
Have a nice day.

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 20 Jul 2021
Hi Jesse,
The simplest fix would be to change 'ProgressPlot',true to 'ProgressPlot',false. The issue is that you're trying to create plots on workers, but the workers do not have a display.
Another option would be to rely on sbiofit to do the parallelization by changing the parfor to a for loop and adding the name-value argument 'UseParallel',true to the sbiofit calls. This would allow you to keep the progress plots.
Also, it's not clear which of these approaches will be faster. A lot depends on the details of your problem and your parallel computing setup.
Jesse Chao
Jesse Chao on 23 Jul 2021
Hello Arthur,
Thank you very much for your explicit answer. I managed to solve this problem by using the suggestion you provided.
Thank your very much.
Have a nice day.

Sign in to comment.

More Answers (0)


More Answers in the  SimBiology Community

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!