%% Create a SimFunction Object
% This example uses a radioactive decay model with the first-order reaction {{dz} \over {dt}} = c \cdot x, where x and z are species and c is the forward rate constant.
% Load the sample project containing the radioactive decay model m1.

sbioloadproject radiodecay;

%
% Create a SimFunction object, specifying the parameter Reaction1.c to be scanned, and species x as the output of the function with no dosed species.

f = createSimFunction(m1, 'Reaction1.c','x', [])

%
% If the UnitConversion option was set to false when the SimFunction object f was created, the table does not display the units of the model quantities.
%
% To illustrate this, first set the UnitConversion option to false.

cs = getconfigset(m1);
cs.CompileOptions.UnitConversion = false;

%
% Create the SimFunction object as before and note that the variable named Units disappears.

f = createSimFunction(m1, {'Reaction1.c'},{'x'}, [])

%
%
% If any of the species in the model is being dosed, specify the names of dosed species as the last argument. For example, if the species x is being dosed, specify it as the last argument.

f = createSimFunction(m1, {'Reaction1.c'},{'x'}, 'x')

%
% Once the SimFunction object is created, you can execute it like a function handle and perform parameter scans (in parallel if Parallel Computing Toolbox™ is available), Monte Carlo simulations, and scans with multiple or vectorized doses. See SimFunction object for more examples.
% Copyright 2012 The MathWorks, Inc.