Matlab Mobile - Extracting my sensor data isnt working properly.

16 views (last 30 days)
Daniel Hauch
Daniel Hauch on 26 Oct 2017
Answered: Daniel Hauch on 30 Oct 2017
Hello all,
i am working with matlab mobile and i am facing a rather annoying problem. I dont even know if it is caused by Matlab Mobile/Matlab/Android or my Smartphone. I work with Matlab R2016a.
After i have created a successful connection between the smartphone and matlab and logged some data, i want to extract it via [Accel, t_Accel] = accellog(m). But the results i get seem to be corrupt/broken. The timevector isnt contiguous and i receive too few data. If i shake my phone for like 15 seconds and the contiguous party of timevec imply a frequency of ~12 Hz my Datamatrix is only 70x3 and not ~180x3 as i would expect.
Does anyone of you know where my problem occurs from? I tested 2 different smartphones and controlling matlab mobile on the smartphone and in matlab with console commands (m.Logging =1 ; m.Logging =0;) and i still get similar problems.
I hope someone has a smart idea.
Greetings

Answers (1)

Daniel Hauch
Daniel Hauch on 30 Oct 2017
I fixed the problem!
If anyone is interested, i will write a quick report.
Making timevector contiguous: delete old mobiledev and create a new one. I dont know why this problem occurs, but this is a simple fix.
Receive logged data completly: Matlab Mobile needs quite some time to postprocess the logged data. Therefore you have to wait some time until the log-functions return vectors with the appropiate length. I automated this process with the code showing below:
t_Accel_old = 0;
while true
%get data from mobiledev and save in var
[Accel, t_Accel] = accellog(m);
if length(t_Accel_old)==length(t_Accel)
break;
end
t_Accel_old = t_Accel;
pause(2);
end
I hope my explanation is helpful and saves someone some time.
Greetings

Communities

More Answers in the  Distance Learning Community

Community Treasure Hunt

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

Start Hunting!