Run sim command with configset from within a ML-function
显示 更早的评论
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
sim(model, ConfigSet)
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)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!