Skip to main content
. 2016 Mar 10;11(3):e0150761. doi: 10.1371/journal.pone.0150761

Table 2. Example Code and Key Commands.

parpool('local',5); Open a parallel pool of 5 MATLAB workers (independen
t MATLAB engines to send each experiment to)
mex main_SSA.cpp Compile C++ files within MATLAB. Each file is
mex main_ACT.cpp a separate experiment to be simulated (e.g. SSA–stead
y state availability, ACT–activation). If possible, the number of workers in ‘parpool’ should equal the number of experiments to be simulated.
Inputs = [ Provide a vector of initial guesses.
    0.1027;
    …
    9.3;
    0.250];
LB = [0; 0;…; 0]; Provide bounds on the parameter values (e.g. strictl
UB = [Inf; Inf;…; Inf]; y positive values: LB–lower bound, UB–upper bound)
options = optimset Provide a list of options to the optimization algorithm
('TolFun', 1e-2, 'MaxIter', 2); (e.g. Maximum iterations, tolerance on the function etc.)
Inputs_Final = fminsearchbnd (@WT_CHANNEL, Inputs,lb,ub, options); Main function call to the minimization algorithm. Use the ‘fminsearchbnd’ (Bounded Nelder-Mead) algorithm to compute the minimum of the function ‘WT_CHANNEL’, with initial guesses provided by the ‘Inputs’ vector, bounded by ‘LB’, and ‘UB’, using the ‘options’ provided.
parfor i = 1:n; Create a parallel ‘for’ loop (‘parfor’) to send each
if i = = 1 experimental protocol to a separate MATLAB worker.
    main_SSA(Inputs); This step simulates each protocol with the vector of
end ‘Inputs’
if i = = 2
    main_ACT(Inputs);
end
end;