Effacer les filtres
Effacer les filtres

variables from model input in simulink mask

3 vues (au cours des 30 derniers jours)
E Luttringer
E Luttringer le 13 Juin 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

Réponses (1)

Jean-Paul Marcade
Jean-Paul Marcade le 19 Juin 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)

Catégories

En savoir plus sur Event Functions dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by