Workspace variable and simout

2 views (last 30 days)
Anne
Anne on 30 Jan 2023
Edited: Fangjun Jiang on 30 Jan 2023
Hello!
I am trying to define a workspace variable (found in Model explorer) for a simulink block (one parameter for the block), which need to be defined to use the block. However, difficulty is that parameter is not static value, but should change throughout the simulation. It means if the value of another signal changes, then that workspace variable and parameter also needs to change.
I tried to use "simout" block, but it return bunch of data. I need to use only one real value as a block parameter saved to work space. It means I should use very last value of the simulation as the block parameter. When the simout value chnages, then also the block parameter must change.
I tried also to find variable parameters simulink blocks, but those were not suitable.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 30 Jan 2023
Edited: Fangjun Jiang on 30 Jan 2023
Your question is too generic. It's better to give specific example or block usage.
A "parameter" of a block is meant to be constant during one whole simulation, for example, the "gain" value of a Gain block.
You can change the parameter before or after a simulation.
There are ways to generate a value dynamically and use the value dynamically in Simulink, but not to use the value as a "parameter" for a block.
There might be ways to change the implementation. For example, if the "gain" value needs to be changed dynamically based on some calculation, you can use a "Product" block to multiple the signal with the calculated value.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!