Discard all logged data from Android sensors
discardlogs(m) discards all logged data,
that acquires the sensor data. The
discards all logged measurements that were created from the object,
and also clears the initial timestamp.
This example assumes that you have already installed and set up MATLAB® Mobile™ on your Android™ device and connected it to your computer running MATLAB. For information about these steps, see Get Started with Android Sensors.
Start MATLAB Mobile on your Android device.
On the Sensors screen of MATLAB Mobile, tap the sensors that you want to send data from.
Place the device where you want to get the sensor data, if a remote location.
On your computer, create a
m = mobiledev
Begin logging data by enabling the
m.Logging = 1
This action starts the transmitting of data from all selected sensors. You can also start transmission by tapping the Start button in MATLAB Mobile on the device.
Get any logged data you are interested in viewing, for example, the angular velocity data.
[av, t] = angvellog(m);
Stop logging data from the selected sensors by disabling
m.Logging = 0
This stops the transmitting of data from all selected sensors. You can also stop transmission by tapping the Stop button in MATLAB Mobile on the device.
You can still access any of the logs after you stop transmitting data. When you are done using the logs, you can discard them.
This discards all logged measurements and also the initial timestamp.
Behavior change in future release
discardlogs will not work on a computer in a future release. The
MATLAB Support Package for Android
Sensors, which includes support for connecting to MATLAB
Mobile on your Android device from MATLAB on a computer, will be removed. You can continue to use
discardlogs in the MATLAB
Mobile app by connecting to the MathWorks® Cloud instead. For instructions on how to use MATLAB on the MathWorks Cloud, see Connect to Android Device.