Documentation

poslog

Return logged position data from Android sensor

Description

example

[lat, lon, timestamp, speed, course, alt, horizacc] = poslog(m) returns the logged position data for one or more of these variables, where m is the name of the mobiledev object that acquires the sensor data, and the other variables represent latitude, longitude, timestamps, speed, course, altitude, and horizontal accuracy. Position data is obtained from GPS, Wi-Fi, or the cellular network, using whichever is available.

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 Position 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 position data for latitude, longitude, timestamps, speed, course, altitude, and horizontal accuracy.

[lat, lon, t, speed, course, alt, horizacc] = poslog(m)

Note

Position data may not appear immediately, due to the way it is collected. You may see a lag in the data.

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 latitude log data, returned as an [mx1] vector of latitude values in degrees relative to the equator, with positive values indicating latitudes north of the equator.

Name of variable for longitude log data, returned as an [mx1] vector of longitude values in degrees relative to the zero meridian, with positive values extending east of the meridian.

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

Name of variable for speed log data, returned as an [mx1] vector of speed values in meters per second.

Name of variable for course log data returned as an [mx1] vector of course values in degrees relative to true north.

Name of variable for altitude log data, returned as an [mx1] vector of altitude values in meters above sea level.

Name of variable for horizontal accuracy log data, returned as an [mx1] vector of radial horizontal accuracy values in meters defined by a circle around the latitude and longitude.

Introduced in R2014b