필터 지우기
필터 지우기

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 CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by