orientlog

Return logged orientation data from iOS sensor

Syntax

[log, timestamp] = orientlog(m)

Description

example

[log, timestamp] = orientlog(m) returns the orientation log, where m is the name of the mobiledev object that acquires the sensor data, log is an [mx3] matrix containing orientation data points for azimuth, roll, and pitch, 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 iOS device and connected it to your computer running MATLAB. For information about these steps, see Get Started with iOS Sensors (MATLAB Mobile for iOS).

Start MATLAB Mobile on your iOS device.

On the Sensors screen, tap the Orientation sensor.

Place the device where you want to get the sensor data.

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.

Get the logged orientation data.

[o, t] = orientlog(m)

This returns the orientation log, where o contains the three data points in degrees, for azimuth, pitch, and roll.

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

Output Arguments

collapse all

Name of variable for orientation log data, returned as an [mx3] matrix of data points from the Orientation sensor on the iOS device. The three data points are the position reading in degrees, for azimuth, pitch, and roll.

Orientation 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.

Azimuth is the angle between the positive Y-axis and magnetic north, and its range is between -180 and 180 degrees.

Positive pitch is defined when the device is lying flat on a surface and the positive Z-axis tilts towards the positive Y-axis, with range between -90 and 90 degrees.

Positive roll is defined when the device is lying flat on a surface and the positive Z-axis tilts towards the positive X-axis, with range between -180 and 180 degrees.

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

Introduced in R2015a