I want to run a simulation in Simulink with sim() command from within a function. I understand that I need to assign the initial values to the model workspace. Matlab's help on sim-command) suggests that I can do this with
sim( model, 'SrcWorkspace', 'current')
Now my problem is that I need to run the simulation model with a user defined ConfigSet. As described in the help on the sim-command, the syntax to call sim with a configset is
Calling sim with both, ConfigSet and Parameter/Value pair, results in an error.
sim( modelname, mySLConfigSet , 'SrcWorkspace','current')
"TIMESPAN" parameter must be a real scalar or vector
sim( modelname , 'SrcWorkspace','current', mySLConfigSet)
The input arguments of a single output sim command should be model name followed by either a structure with valid parameters as fields with corresponding values or a set of parameter name and
parameter value pairs
The simulation works fine, when I call sim from a script.
Now my question: Is there an easy way to combine both, i.e. run a simulink model with sim() command and with user defined ConfigSet from within a matlab function, i.e. with a user defined source workspace?
(I use Matlab R2013b with an slx-model)