How to put variable name in Y-limits of a scope in Simulink programmatically from Matlab
1 view (last 30 days)
Show older comments
Wicki Byamba
on 30 Mar 2021
Commented: Wicki Byamba
on 8 Apr 2021
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
0 Comments
Accepted Answer
Fangjun Jiang
on 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 Comments
Fangjun Jiang
on 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
- Manually set "YY" in the Scope block, then change the value of "YY" as needed.
- Whenever need to change the value of "YY", run set() command
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!