acceleration function not working in script?

Hello, i'm trying to assign the value returned from the acceleration function in the mobiledev object
In the m variable I can see the acceleration values but when I call the acceleration function and assign its output to the variable 'x' nothing is in it.
When I run m.acceleration in the command window it works fine so why doesn't it work in this script?
Thanks

답변 (1개)

Yongjian Feng
Yongjian Feng 2021년 7월 3일

0 개 추천

In general, the debugger shall be able to show you the reason. Just run your Untitle2.m using the matlab debugger, and put a breakpoint in line 5. Then you can examine m directly.

댓글 수: 4

Will Isom
Will Isom 2021년 7월 4일
Yeah I can see that the m object contains the correct acceleration values but when I call the acceleration function on the m object it doesnt return anything which I cant understand.
I've been following this documentation: https://uk.mathworks.com/help/matlabmobile/ug/sensor-data-collection-with-matlab-mobile.html
Set a breakpoint at line 5, and when the debugger pauses there, copy line 5 and paste to the command line window. What do you get for x from the command line window?
Will Isom
Will Isom 2021년 7월 4일
Im using a waitfor function which works , why do I need to use this in a script but yet in command window I can call the acceleration function and the values are returned with no problem?
Oh, a time delay? The command line window somehow is slower than the function call? Where do you put the waitfor function?

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

카테고리

도움말 센터File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

질문:

2021년 7월 3일

댓글:

2021년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by