Main Content

Location Sensor

Measure GPS data

  • Location Sensor block

Simulink Support Package for Apple iOS Devices / Sensors


The block reads GPS data of the device and outputs its latitude, longitude, and altitude.

The GPS measurements are referenced to the most recent revision of the World Geodetic System (WGS84). GPS sensor accuracy is typically measured in meters. When converting latitude and longitude from decimal degrees to meters, the decimal degree values are considered to within 6 decimal places only. For example, at the equator, 0.000001 degrees is approximately 11.1 centimeters.


GPS must be enabled on the device. If any of these conditions occur, this block outputs zeros.

  • GPS is disabled on the device.

  • The device does not contain a GPS sensor.

  • Simulating without a device

For more information, see Block Produces Zeros or Does Nothing in Simulation.



expand all

GPS data of the device, returned as a three-element numeric vector of the form [latitude, longitude, altitude]. The vector contains the measured latitude and longitude in decimal degrees and altitude in meters.

Data Types: single


expand all

Specify a discrete time interval, in seconds, at which the block reads the GPS data from the device and outputs the data.


Smaller values for Sample time require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2015a