pwAddModel
ok = pwAddModel(filenames, useMatIfUpToDate, arguments)
ok = pwAddModel(m)
Adds one or more models to the list of avaible model
data couples. The model can either be reaction or ODE based.
filenames Single filename or cell array of filenames
If no file is specified, a file selection dialog opens.
If no file extension is specified, .m is assumed.
useMatIfUpToDate true or false (default)
If true and a modelID.mat file exists which is younger
than the modelID.m file, the mat file will be loaded.
arguments Cell array of arguments that will be passed to the
model.
m Alternatively, a model struct m can be passed to the
pwAddModel function. The struct m should have been
initialized using pwGetEmptyModel and modified using
pwAddX, pwAddR, pwAddY, etc.
ok True, if all models could be loaded successfully.
Description
The model search path is:
1. Current working folder
2. ../Models
3. Model folder as specified in the configuration
Avoid to load mat files, if mother/daughter models
are used, because changes in the daugther model do
not change the time stamp of the mother model file, hence
an old mat file will be loaded.
Passing arguments
Since each model is a Matlab function, it is possible to pass function
arguments. This can be used e.g. to define different variants of a model
within the same file. The value of the passed variable will define
which is used. It is recommended to change also the model ID depending
on the used variant.
Examples
% Model example header with a passed argument 'inhibitor'.
% If no inhibitor is specified, the user can select it from a list.
function m = getModel(inhibitor)
m = pwGetEmptyModel();
if ~exist('inhibitor','var') || isempty(inhibitor)
inhibitors = {'Inhibitor1', 'Inhibitor2', 'Inhibitor3'};
i = General_GUISelectItems(inhibitors, 'Please select one inhibitor');
inhibitor = inhibitors{i};
end
% Adding a model
pwAddModel('M1')
pwAddModel({'M1', 'M2'});
See also