%% Set Maximum Number of Logs Criteria to Stop Simulation
% Set the maximum number of logs that triggers a simulation to stop.
% Create a model object named cell and save it in a variable named modelObj.

modelObj  = sbiomodel('cell');

%
% Retrieve the configuration set from modelObj and save it in a variable named configsetObj.

configsetObj = getconfigset(modelObj);

%
% Configure the simulation stop criteria by setting the MaximumNumberOfLogs property to 50. Leave the StopTime and MaximumWallClock properties at their default values of 10 seconds and Inf, respectively.

set(configsetObj, 'MaximumNumberOfLogs', 50)

%
% View the properties of configsetObj.

get(configsetObj)

% When you simulate modelObj, the simulation stops when 50 logs are created or when the simulation time reaches 10 seconds, whichever comes first.
% Copyright 2012 The MathWorks, Inc.