This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Set Up and Connect to Apple iOS Device

Connect to iOS Device

You can use MATLAB® on a computer or on the MathWorks Cloud. The following sections outline the connection procedure for each scenario.

Use MATLAB on a Computer

Before you can acquire sensor data from your iOS device, you need to set up MATLAB on your computer to communicate with MATLAB Mobile™. You need to do this only once on the computer you use to communicate with the iOS device.

If you have not already done so, download and install the MATLAB Support Package for Apple iOS Sensors on your computer, and MATLAB Mobile on your iOS device. See Get Started with iOS Sensors for complete setup steps.

This example shows how to set up using MATLAB on a computer, and assumes that your computer and device are on the same wireless network. (For information on alternative configurations, see the MATLAB Mobile documentation.)

  1. Use MATLAB Connector™ to set up the connection between your computer running MATLAB and the MATLAB Mobile application on your iOS device. In the MATLAB Command Window, enter

    connector('on', 'password', 'mypassword');

    Specify your own password in the last argument.

    Use the default port. To check which port the connector is using, start the connector and look at the URL it displays for the test link.

  2. In the MATLAB Command Window, click the test link displayed to ensure that the computer is ready to connect. Note the DNS name and IP address, which you need to complete the connection.

  3. In MATLAB Mobile, select Connect to Your Computer. If you previously connected to the cloud or a different computer, go to Settings, and tap Add a Computer.

  4. In the Computer setting, enter the DNS name or IP address that was displayed in step 2.

  5. In the Connector Password setting, enter the password that you specified in step 1.

  6. Save your settings, and start the connection by tapping Connect at the top of the screen.

  7. In subsequent MATLAB sessions with the same computer, start the connection on the computer and the device.

    In MATLAB, enter connector on.

    In MATLAB Mobile Settings, tap the button next to the computer IP address in the Connect to Your Computer section.

  8. You can now create your mobiledev object and start acquiring data, as described in Acquire Sensor Data Streaming.


If you are using Wi-Fi® as your connection method, you may have to adjust the sleep setting on your iOS device.


If you turn off MATLAB Connector after you have created a mobiledev object, the object is not able to receive data from the device, even if the Connector is turned on again. You have to create another mobiledev object.

Use MATLAB on the MathWorks Cloud

Alternatively, you can use MATLAB on the MathWorks Cloud instead of a computer. The support package is already installed in the MathWorks Cloud. If you use MathWorks Cloud, connect to the Cloud in Settings .

  1. In MATLAB Mobile on your device, go to Settings > Connect to MathWorks Cloud.

  2. Tap MathWorks Account.

  3. Enter your credentials on the MathWorks Account screen and tap Log In.

  4. You can now create your mobiledev object and start acquiring data, as described in Acquire Sensor Data Streaming.

iOS Sensors Settings in MATLAB Mobile

To access sensor settings in MATLAB Mobile, tap the Settings icon, and then scroll to the Sensors section.

  • Control from MATLAB — When enabled, controls the sensors and logging of data from MATLAB. This setting is enabled by default.

  • Send Position Data in Background — When enabled, allows the position sensor to continue sending data to MATLAB while you are using other apps. This setting is disabled by default. The other sensors cannot send data in the background.

  • Getting Started with Sensors — Instructions on setting up sensor data collection.


If you are using Wi-Fi as your connection method, you may have to adjust the sleep setting on your iOS device.

Sensors Screen in MATLAB Mobile

To access sensors in MATLAB Mobile, tap Sensors.

Turn the five sensors on and off by tapping their icons.

  • Acceleration — Acceleration reading in X, Y, and Z coordinates, in m/s2 (meters per second squared)

  • Magnetic Field — Magnetic field reading in X, Y, and Z coordinates, in microtesla

  • Orientation — Position reading in X, Y, and Z coordinates, in degrees, for azimuth, pitch, and roll

  • Angular Velocity — Angular velocity reading in X, Y, and Z rotations, in radians per second

  • Position — Data points representing latitude, longitude, speed, course, altitude, and horizontal accuracy. Position data is obtained from GPS, Wi-Fi, or the cellular network, using whichever is available. The measurements are:

    Latitude in degrees relative to the equator, with positive values indicating latitudes north of the equator

    Longitude in degrees relative to the zero meridian, with positive values extending east of the meridian

    Speed in meters per second

    Course in degrees relative to true north

    Altitude in meters above sea level

    Horizontal Accuracy in meters defined by a circle around the latitude and longitude

Measurement readings begin when you tap a sensor. Readings display below the buttons in the order in which you select the sensors.

After you have selected sensors, use the Start button to send the data to MATLAB on your computer. You can also start the transmission of data from MATLAB programmatically using the Logging property. You can stop the transmission using the Stop button on the device, or the Logging property in MATLAB.