How to put variable name in Y-limits of a scope in Simulink programmatically from Matlab

1 vue (au cours des 30 derniers jours)
I want to put variables names in the Y-limits of a scope in Simulink( v10) with Matlab (v2019b). To be able to control the Y-limits of my scopes with variables associated to the thing i'm measuring.
I can do it with the GUI via the Y-limits (minimum) and Y-limits (maximum) but the value stored in Y-limits (when i do "get_param(path,'scopeconfiguration')") is the vector with the numerical value.
But when I try to do it programmaticall, I can't put variable names. As it only accept 2-element finite numeric vector.
Thanks in advance
Byamba

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 30 Mar 2021
Seems true but also, it works this way.
>> YY=5
YY =
5
>> set(gcbh,'ActiveDisplayYMaximum','YY')
>> get(gcbh,'ActiveDisplayYMaximum')
ans =
'5'
>> YY=3
YY =
3
>> set(gcbh,'ActiveDisplayYMaximum','YY')
>> get(gcbh,'ActiveDisplayYMaximum')
ans =
'3'
  3 commentaires
Fangjun Jiang
Fangjun Jiang le 31 Mar 2021
Let's assume YY=2. You can type in "YY" in the block parameter dialog window of the Scope block and click "Ok" or "Apply". The "YY" stays there but if you then run get(gcbh,'ActiveDisplayYMaximum'), you will get '2'.
Run "YY=1;get(gcbh,'ActiveDisplayYMaximum')", you will get "1".
Run "YY=3;get(gcbh,'ActiveDisplayYMaximum')", you will get "3".
Not sure why this happens. Probably can dig further to see where "YY" is saved at. But I hope this provide you with a workable solution. Either
  1. Manually set "YY" in the Scope block, then change the value of "YY" as needed.
  2. Whenever need to change the value of "YY", run set() command
Wicki Byamba
Wicki Byamba le 8 Avr 2021
okey, it's not optimal but I'll work with that.
Thank you for your assistance :)

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by