Get Started with iOS Sensors

Note

The MATLAB® Support Package for Apple iOS Sensors and support for MATLAB Mobile™ access from a computer will be removed in a future release. Use mobiledev and other support package functionality in the MATLAB Mobile app by connecting to the MathWorks® Cloud instead.

Requirements for Using MATLAB Support Package for Apple iOS Sensors

The MATLAB Support Package for Apple iOS Sensors enables you to collect sensor data from your iOS device and log it in MATLAB. You can use MATLAB to process the sensor data in a variety of ways, including creating plots. You can collect data from these sensors:

  • Acceleration

  • Angular Velocity

  • Orientation

  • Magnetic Field

  • Position

Use of iOS sensors requires:

  • Installation of MATLAB Mobile on your iOS device. You can acquire this application through the App Store.

  • Installation of the MATLAB Support Package for Apple iOS Sensors on your computer, or a MathWorks Cloud account. The support package is already installed in the MathWorks Cloud.

  • MATLAB R2015a or later, for creating the connection to the application and logging sensor data.

  • iOS 8 or later on your device.

The support package includes the command-line interface in MATLAB and the ability to interact with iOS sensors via a screen in MATLAB Mobile. To connect to sensors on the device and collect data, you create a mobiledev object in MATLAB. You make the connection between your computer running MATLAB and the device via Wi-Fi® or your cellular network, or use MATLAB on the MathWorks Cloud.

Note

Please note that MATLAB Mobile and MATLAB Connector™ are intended for use behind a firewall on a private network. If you plan to use MATLAB Mobile and MATLAB Connector over the public Internet, via 3G, or via 4G, it is recommended you use a virtual private network (VPN).

Start Sending Sensor Data

  1. Install the support package in MATLAB if you will be running the MATLAB session on a computer.

  2. Install MATLAB Mobile on your iOS device.

  3. Using MATLAB Connector, connect your iOS device to the computer running MATLAB, via Wi-Fi or your cellular network. Alternatively, you can use the MathWorks Cloud. For details, see Set Up and Connect to Apple iOS Device.

  4. Review the sensor settings in MATLAB Mobile. On the Settings screen, tap the Settings icon, and 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.

  5. In MATLAB, create a mobiledev object to access the sensor data.

    m = mobiledev

    For more details, see Acquire Sensor Data Streaming.

  6. You can control the sensors, log the sensor data, query latest values, and plot the data or do other post-processing tasks. For details on these actions, see Acquire Sensor Data Streaming, Use Properties to Control iOS Sensor Acquisition, and Use Logged Sensor Data.