Can I specify the workspace in which a Simulink model will look for parameters when I call it by name from the MATLAB command prompt?

2 views (last 30 days)
I would like to call a Simulink model by name and return information about the states, as in the syntax below for the vdp demo model:
[sys,x0,str,ts] = vdp([],[],[],'sizes');
I am using this feature from a function, so it has its own workspace. The MODEL command evaluates parameters in the base workspace by default. Is there a way to specify the workspace in which the model evaluates parameters, such as the SrcWorkspace option for the SIM command?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to specify the workspace in which parameters are evaluated by the MODEL command is not currently available in Simulink. As a workaround, consider the following options:
1. Use the EVALIN and ASSIGIN commands to set the variables in the base workspace.
2. Create the parameters in the Simulink Workspace using Model Explorer or the Simulink command-line functionality. Once the parameters are defined in the Simulink Workspace, then you can use SET_PARAM to set their values. For more information on this process, execute the following command at the MATLAB command prompt to see the appropriate documentation:
web([docroot,'/toolbox/simulink/ug/working_with_data11.html#90636'])

More Answers (0)

Categories

Find more on Simulink Environment Customization in Help Center and File Exchange

Products


Release

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!