How do i read android's sensor data in real time within MATLAB PC via the USB cable ?

24 ビュー (過去 30 日間)
Kiat Nern Yeo
Kiat Nern Yeo 2019 年 6 月 7 日
コメント済み: Sruthi Yenugula 2019 年 6 月 10 日
Hello all
How do i read android's sensor data in real time within MATLAB Simulink PC via the USB cable ?
For example, i would like to be able to see the accelerometer, gyroscope and orientation data within Simulink's data display and scope blocks.
Below is an example of what i am trying to do. I want to capture the real time output from my Android sensor block, as well as read the output of my transfer function in the scope.
However i only get blanks in the scopes and the displays
img1.PNG
Any help is greatly appreciated.
Thank you very much !

採用された回答

Sruthi Yenugula
Sruthi Yenugula 2019 年 6 月 7 日
Use external mode, to see that sensor data in Simulink or you can directly deploy the app on Android device and see the results on device screen.
To run model in external mode, use this link

その他の回答 (1 件)

Kiat Nern Yeo
Kiat Nern Yeo 2019 年 6 月 9 日
Hi Sir. Thank you for replying
I have went through the example and the app can indeed be deployed onto my phone, and the sensor values can be read within my phone's screen.
However, it still does not show up in simulink's scope or display blocks.
I have also performed androidhwsetup, and the test app can run.
The USB cable is also always attached, and both the phone and computer are connected to the same private network.
I also have the proper android driver installed, along with the required android studio SDK and NDK.
Is there something that i could have missed ?
Best regards sir.
  1 件のコメント
Sruthi Yenugula
Sruthi Yenugula 2019 年 6 月 10 日
To see the results in Simulink, you should run the model in external mode, make sure the simulation time is set to inf by default it is 10s. Use display block(not android data display ) of Simulink block is see the data in Simulink.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by