Main Content

poslog

Return logged position data from mobile device sensor

Description

Add-On Required

To use this function for accessing mobile device sensors remotely from MATLAB® installed on a desktop or laptop computer, you must also install either MATLAB Support Package for Apple iOS Sensors or MATLAB Support Package for Android® Sensors. For more information, see Get and Manage Add-Ons.

[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. The output variables are each an N-by-1 vector of latitude, longitude, timestamps, speed, course, altitude, and horizontal accuracy, where N is the number of samples acquired during the capture duration. Position data is obtained from GPS, Wi-Fi, or the cellular network, using whichever is available.

example

Examples

collapse all

This example assumes that you have already installed and set up MATLAB Mobile™ on your mobile device. If you have not, see Install MATLAB Mobile on Your Device.

If you want to read the data in a different session of MATLAB, start MATLAB Online™ or MATLAB on your local computer.

Start MATLAB Mobile on your device.

On the Sensors screen, tap the Position sensor.

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

In your MATLAB session, create a mobiledev object, m.

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 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 might see a lag in the data.

See Device Orientation 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 N-by-1 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 N-by-1 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 N-by-1 vector of timestamps from the Position sensor on the mobile device. Time is in seconds, relative to the InitialTimestamp property.

Name of variable for speed log data, returned as an N-by-1 vector of speed values in meters per second.

Name of variable for course log data returned as an N-by-1 vector of course values in degrees relative to true north.

Name of variable for altitude log data, returned as an N-by-1 vector of altitude values in meters above sea level.

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

Version History

Introduced in R2015a