Main Content

Location Sensor

Measure global positioning system data

  • Location Sensor block

Simulink Support Package for Android Devices / Sensors


Use the Location Sensor block to read GPS data of the device and output 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

The block outputs the latitudinal data of the device.

Data Types: double

The block outputs the longitudinal data of the device.

Data Types: double

The block outputs the altitude data of the device.

Data Types: double


expand all

Specify a discrete time interval, in seconds, at which the block reads the GPS sensor of 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 R2014a