Real Time Data Acquisition of Android using Matlab

Hello,
I'm trying to use the support package for android devices to access sensor data of the device in matlab.
However, there is one problem facing me. I want to read the new data as soon as they are ready, thus I created a polling loop but it seems that the code is stuck in the loop and won't pass it for some reason.
The code is shown bellow
connector on;
m = mobiledev;
m.SampleRate = 'High';
m.OrientationSensorEnabled = 1;
m.Logging = 1;
[o, to] = orientlog(m);
while(size(m.orientation,1) == 0)
[o, to] = orientlog(m);
end
The code never gets out of the while loop, if someone can explains this behavior to me and how can i detect the data as soon as it's ready I would be so thankful.
Regards, Marwan Chawa

Answers (1)

You might possibly need a pause() or drawnow() to give time for the sensor callbacks to run.

Asked:

on 21 Mar 2016

Answered:

on 6 Apr 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!