How to update programmatically a parameter value in a referenced masked model?
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Nicolas Oriol
il 29 Nov 2019
Commentato: Nicolas Oriol
il 2 Dic 2019
I have a masked model (let's call it sensor_mdl). Parameters were created in the model workspace as Matlab variables, and set as Arguments. The parameters in the mask refer to the corresponding parameters in the model workspace.
I added this model as a referenced model in another model, called sensor_top, which can contain one or more instances of sensor_mdl.
I am trying to update programmatically the values used for sensor_mdl in sensor_top.
I use the commands:
load_system('sensor_top')
objMask = Simulink.Mask.get('sensor_top/Model');
objMaskParameters = objMask.Parameters;
parameter1 = objMaskParameters(1);
parameter1.set('Value', 1);
But I get the error message:
"Unable to modify the mask of block 'MTM_top/Model'. Modify the referenced model's mask definition instead."
Any idea why and how to fix this?
0 Commenti
Risposta accettata
Stefanie Schwarz
il 29 Nov 2019
Hi Nicolas,
editing the Mask object is not the correct workflow. Just use set_param:
set_param('sensor_top/Model','ParamName','1');
See also:https://uk.mathworks.com/help/releases/R2019b/simulink/ug/parameterize-referenced-models.html
HTH,
Stefanie
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Author Block Masks 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!