STOP WHILE CYCLE FROM MOBILE APP

1 次查看(过去 30 天)
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 个评论
Geoff Hayes
Geoff Hayes 2019-5-30
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.

请先登录,再进行评论。

采纳的回答

Geoff Hayes
Geoff Hayes 2019-5-30
编辑:Geoff Hayes 2019-5-30
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 个)

社区

类别

Help CenterFile Exchange 中查找有关 App Building 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by