Unable to set gain control as a variable in Simulink, setting a numeric value works OK.

5 views (last 30 days)
Simulink Version 9.3 (R2019a)
I'm unable to set the Gain control as a variable. The entire Gain block turns red with an exclamation mark.
Setting the Gain as a numeric value works OK.
Thank you.

Answers (1)

Paul
Paul on 1 Sep 2021
It turns red with the exclamation mark because you haven't defined the variable in any workspace that the model can see (typically the base or model workspace) and/or you haven't updated the model since the variable was defined. For example, if the parameter in the Gain block is 'mygain' then define it with a value in the base workspace
>> mygain = 1;
Then update the diagram.

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!