Azzera filtri
Azzera filtri

variables from model input in simulink mask

3 visualizzazioni (ultimi 30 giorni)
E Luttringer
E Luttringer il 13 Giu 2024
Risposto: Jean-Paul Marcade il 19 Giu 2024
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

Risposte (1)

Jean-Paul Marcade
Jean-Paul Marcade il 19 Giu 2024
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)

Categorie

Scopri di più su Event Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by