I try to develop a code to acquire data from sensors. I want to use Matlab Mobile App. My question is that is possibile to acquire Data until (while cycle) I press "STOP" button in app. I try whit this code, but it dosen't work
clear all
close all
clc
m = mobiledev;
m.AccelerationSensorEnabled = 1;
m.AngularVelocitySensorEnabled = 1;
m.Logging = true;
while m.Logging
[a,~] = accellog(m);
[ang,~] = angvellog(m);
end
IMG_84A8CA9651F7-1.jpeg

댓글 수: 2

Lorenzo - I haven't used the mobiledev app before, but some GUIs that are designed in a similar manner with a "tight" while loop (i.e. a loop that is not interruptible) require that you add a short pause to the code. Try updating your code as
while m.Logging
[a,~] = accellog(m);
[ang,~] = angvellog(m);
pause(0.001);
end
to see if that helps.
Lorenzo Giannini
Lorenzo Giannini 2019년 5월 30일
It works! Thanks!

댓글을 달려면 로그인하십시오.

 채택된 답변

Geoff Hayes
Geoff Hayes 2019년 5월 30일
편집: Geoff Hayes 2019년 5월 30일

0 개 추천

Some GUIs that are designed in a similar manner with a "tight" while loop (i.e. a loop that is not interruptible) require that you add a short pause to the code. If the code is updated to
while m.Logging
[a,~] = accellog(m);
[ang,~] = angvellog(m);
pause(0.001);
end
then this seems to fix the problem.

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  원격 교육 커뮤니티

카테고리

도움말 센터File Exchange에서 Sensor Data Collection에 대해 자세히 알아보기

질문:

2019년 5월 30일

편집:

2019년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by