フィルターのクリア

variables from model input in simulink mask

3 ビュー (過去 30 日間)
E Luttringer
E Luttringer 2024 年 6 月 13 日
回答済み: Jean-Paul Marcade 2024 年 6 月 19 日
Hello,
I'm struggling with Simulink, to make the link beetwen a model input and variables usable in block masks. For exemple, the "Compare To Constant" block proposes some tuning parameters in its masks, but I need to make them available as model inputs, for example "cval" for the constant to compare with. (This is just for illustration purpose, I know that it exists a comparison bloc with two entries).
If the "cval" variable exists in the base or model workspace, there is no error and the "Step" function works without other artifices. But the value is fixed and shall be changed with a new matlab command cval=<new value>. A matlab function bloc with "assignin" command could do the job, but the "assignin" function does not work with code generation.
In my case I want to customize the parameter "cval" through a model input, but I don't know how to do.
Does somebody has a solution?
Thanks

回答 (1 件)

Jean-Paul Marcade
Jean-Paul Marcade 2024 年 6 月 19 日
Hi,
The parameter writer block is probably what you are looking for (https://www.mathworks.com/help/simulink/slref/parameterwriter.html). The workflow is explained in this other thread : https://www.mathworks.com/matlabcentral/answers/2000912-how-can-i-enter-a-mask-parameter-to-a-block-through-an-input-block-in-simulink-r2021b (From R2022b, this is more straightforward)

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by