get_param returns the same value to a changing signal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hello,
i have a problem running a realtime simulation with m. file
the simulink is running and i try to read and store the data in real time.
the y output is the same value in all lines, but the input and the display values are changing...
the code :
or n=1:1000
rto1 =get_param('FRFsimulink3_rt_test1/Display4','RuntimeObject') ;% output mesurment from system (sensor read)
% storing the collected data in matrics
y(n,1)= rto1.InputPort(1).Data;
pause(1/8000)
end
0 Kommentare
Antworten (1)
Sugandhi
am 25 Apr. 2023
Hi Amir Hatav,
I understand that you are getting unexpected output y on running a real-time simulation with a .m file even though the input and the display value are changing.
From the code you provided, I infer that you are storing the output from the system into rto1 and the data field into y.
One of the possible reasons for having the same values in all lines of y could be that rto1.InputPort.Data is a single value or 1x1 vector.
Please go through the code below for a better understanding.
n= 1:5;
d=10;
y(n,1)=d % assigning value d to matrix y
n= 1:5;
d=[10];
y(n,1)=d % assigning vector d to matrix y
To resolve the issue, try to debugging variable rto1 and get information on the fields it has, the type of fields and the size of each field.
For more information kindly go through the following link –
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!