Setting Y-Limits of a target scope using Simulink Real-Time Explorer
3 views (last 30 days)
Hello, I've been using Simulink Real-Time on a Speedgoat machine for a while and using two different versions of Matlab (r2015b and r2016a) and I've run into this bug several times: tweaking the Y-Limits of a Target Scope using Simulink Real-Time Explorer of a running model doesn't very often work as expected.
Just to contextualize the matter, the Y-Limits values in Simulink Real-Time Explorer are formatted as follows:
assuming a is the lower limit and b is the upper limit, with the comma "," being the separator of the two values. Autoscale is invoked using [0,0]
Now, when I try to modify the values of a and b in real time it seems to work only when they are integer!!! For some reason, including any decimal value results in an incorrect operation. As a decimal separator I tried using both the dot "." (intuitively, since the comma "," is used as a value separator) and the comma ","; the first causes the integer and decimal part to be fused, i.e. 1.2 becomes 12 after pressing enter, while the second causes the decimal part to be discarded, i.e. 1,2 becomes 1. Different story when the integer is zero and the non-decimal part is nonzero: using the dot causes the zero to be discarded and only transform the decimal into an integer, i.e. 0.52 becomes 52, while using the comma causes this [0,5, 2] -> [0, 5] or this [0, 2,5] -> [0, 2]. I also noticed that, in some cases when one of these notation bugs kick in, the values of Y-Limit showing in the Simulink Real-Time Explorer can be completely unrelated to the actual values shown in the Target scope.
On a related note, I often use an instrumentation panel (also through Simulink Real-Time Explorer) to control some values of my model parameters in real time and there the comma does indeed work as a decimal separator (Simulink works in mysterius ways).
Sorry for the long post, but I wanted to mentioned all the wrong "cases" I found out.
Martijn on 8 Aug 2016
The issue which you are seeing appears to be a bug in the real-time explorer when working with a locale which uses comma as decimal separator. To work around this bug, you can:
1. Change the scope settings from the MATLAB Command Line instead of the real-time explorer:
tg = slrt; s = getscope(tg); s.YLimit = [-3.14,3.14]
Note: use dot as decimal separator and comma to separate the elements here.
2. Change your locale settings in Windows to a locale which works with dot as decimal separator.