I am trying to read sensor data directly through MATLAB code. When I use OpenIMU monitor to do the same, it reads data correctly.
But with MATLAB, even after a successfuk serial connection establishment, it is unable to receive any bytes.
I would like your advice about it, if I am doing something wrong.
delete(instrfind({'Port'},{'COM3'}));
% Open serial connection to Aceinna sensor
s = serial('COM3');
set(s,'BaudRate',115200);
fopen(s);
% Read in binary data from sensor
% data = fread(s, s.BytesAvailable);
% Check the number of bytes available before reading
bytesAvailable = get(s, 'BytesAvailable');
if (bytesAvailable > 0)
data = fread(s, bytesAvailable);
else
disp('No data available')
end