MATLAB Answers

How to pass parameters from App Designer to Simulink

22 views (last 30 days)
In an app that runs a Simulink model, what is the best way to pass parameters from AppDesigner to Simulink?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Jul 2020
Edited: MathWorks Support Team on 10 Jul 2020 at 12:49
The first and maybe most straightforward way to do this is to use the set_param command in the code of the App. This will directly change any parameter of a block in a Simulink model, including parameter values.
You can also set values in the model workspace programmatically using the evalin command. More information on that command can be found at the following link:
Similarly, you can use Simulink.SimulationInput class that temporarily set block and model parameters, as well as ex initial states, external inputs, and variables:
Finally, if you plan of deploying this model, perhaps you want to consider Simulink Complier. Read more about setting values this way in the Set the Values of the Tunable Parameters and the Input Signal section of this page.
In short, there are several ways to accomplish this, and the best way to do so will depend on your specific workflow.

  0 Comments

Sign in to comment.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2018a

Translated by