Documentation

accellog

Return logged acceleration data from Android sensor

Description

example

[log, timestamp] = accellog(m) returns the acceleration log, where m is the name of the mobiledev object that acquires the sensor data, log is an [mx3] matrix containing acceleration data points, and timestamp is an [mx1] vector of timestamps.

Examples

collapse all

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 Install MATLAB Mobile on Your Android Device (MATLAB Mobile for Android) and Sign In to the Cloud (MATLAB Mobile for Android).

Start MATLAB Mobile on your Android device.

On the Sensors screen of MATLAB Mobile, tap the Acceleration sensor.

Place the device where you want to get the sensor data, if a remote location.

On your computer, create a mobiledev object, m, in MATLAB.

m = mobiledev

Begin logging data by enabling the Logging property.

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 the logged acceleration data.

[a, t] = accellog(m)

This returns the acceleration log, where a contains the three data points for the acceleration reading in X, Y, and Z coordinates, in m/s^2 (meters per second squared).

See Device Orientation (MATLAB Mobile for Android)for a diagram showing the X, Y, and Z axes relative to the device.

Output Arguments

collapse all

Name of variable for acceleration log data, returned as an [mx3] matrix of data points from the Acceleration sensor on the Android device. The three data points are the acceleration reading in X, Y, and Z coordinates, in m/s^2 (meters per second squared).

Acceleration is defined in relation to the X, Y and Z axes. If you set the device down face-up on a table, the positive X-axis extends out of the right side of the device, positive Y-axis extends out of the top side, and the positive Z-axis extends out of the front face of the device. This is independent of the orientation of the device.

Name of variable for timestamp, returned as an [mx1] vector of timestamps from the Acceleration sensor on the Android device. Time is in seconds, relative to the InitialTimestamp property.

Introduced in R2014b