The MATLAB® Support Package for Android™
Sensors and support for MATLAB
Mobile™ access from a computer will be removed in a future release. Use
mobiledev and other support package functionality in the MATLAB
Mobile app by connecting to the MathWorks® Cloud instead.
The MATLAB Support Package for Android Sensors enables you to collect sensor data from your mobile Android device, such as a phone or tablet, and log it in MATLAB. You can then process the sensor data in MATLAB in a variety of ways, including creating plots. You can collect data from the following sensors:
The Android Sensors support package requires the following:
Installation of MATLAB Mobile on your Android device. You can get this application from the Google Play™ store.
MATLAB version R2014a or later, for creating the connection to the application and logging sensor data.
Installation of the MATLAB Support Package for Android Sensors on your computer, or a MathWorks Cloud account. The support package is already installed in the MathWorks Cloud.
The support package includes the command-line interface in MATLAB and
the ability to interact with the Android Sensors in MATLAB
You create a
mobiledev object in MATLAB to
connect to the sensors on the device, and then collect the data. You
can make the connection between your computer running MATLAB and
the device via either Wi-Fi or your cellular network, or use MATLAB on
the MathWorks Cloud.
Please note that MATLAB Mobile and MATLAB Connector™ are intended for use behind a firewall on a private network. If you plan to use MATLAB Mobile and MATLAB Connector over the public Internet, via 3G, or via 4G, it is recommended you use a Virtual Private Network (VPN).
Follow these steps to get started sending sensor data using the MATLAB Support Package for Android Sensors.
Install the support package in MATLAB if you will be running the MATLAB session on a computer.
Install MATLAB Mobile on your Android device. You can get this application from the Google Play Store.
Using MATLAB Connector, connect your Android device to the computer running MATLAB, via Wi-Fi or your cellular network. Alternatively, you can use the MathWorks Cloud. For details, see Set Up and Connect to Android Device.
Please note that MATLAB Mobile and MATLAB Connector are intended for use behind a firewall on a private network. If you plan to use MATLAB Mobile and MATLAB Connector over the public Internet, via 3G, or via 4G, it is recommended you use a Virtual Private Network (VPN).
Review the sensor settings on the device, on the Settings screen of MATLAB Mobile. To access them, tap the Menu button, then Settings, and then scroll to the Sensors section.
Control from MATLAB — this is on by default and needs to remain on in order to control the sensors and logging of data from MATLAB.
Send Data in Background — this is off by default, but turn it on if you want to continue to send sensor data when the application goes into the background on the device.
Getting Started with Sensors — use to access the Getting Started information.
In MATLAB, create a
to access the sensor data.
m = mobiledev
For more details, see Acquire Sensor Data Streaming.
You can then control the sensors, log the sensor data, query latest values, and plot the data or do other post-processing tasks. For details on these actions, see Acquire Sensor Data Streaming, Use Properties to Control Android Sensor Acquisition, and Use Logged Sensor Data.