define variable value in simulink model

1,086 views (last 30 days)
I use variable 'L' inside gain block.
How can I define the value for 'L' without using the command window in Matlab? I want the user can edit the variable value In the model, something like in the added image. <<
Thank you!

Accepted Answer

Rajani Metri
Rajani Metri on 11 Feb 2020
Use "Model Explorer" from View Option . Then Select Simulink Parameter and Add. Then Rename the 'Parameter' with the variable you set in the Simulation and write the 'value', close the window.
Then RUN the simulation, it will take the values of the Gain Block directly, no need to write the values in the Command Window.

More Answers (1)

ES on 7 Aug 2017
Instead of a Gain, use a divide(product) block. First argument is the signal, Second will be from a data store read (the pair of data store write).
  1 Comment
yoni stein
yoni stein on 9 Aug 2017
thanks. That will work, but it ain't pretty..

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!