Get 1st element/reading from a Real-time encoder readings
1 view (last 30 days)
I am using an absolute encoder to read my motor in real time through udp on Simulink Real-time, and i would like to save the 1st element from the readings (the position at which the encoder starts at) to use it later on,
I am using the very simple function below, i tried to modify it to include a dynamic array thast stores all values of encoder yet, without success,
Thanks in advance!
function y = Encoder_I(Encoder_Readings)
y = Encoder_Readings(1);
Dimitri MANKOV on 24 Oct 2022
Edited: Dimitri MANKOV on 24 Oct 2022
How about using a block-based approach instead? You could for example go for something similar to this:
In this case, I use the simulation time to switch between the new data and the data from the previous step, but you can adjust that condition to your use case.
I hope this is helpful!