Log Sensor Data Locally

You can acquire sensor data locally on an iOS device, with or without a network connection. You can use this alternative method for collecting sensor data instead of streaming it from the device to the MathWorks® Cloud. This is especially useful if you want to collect sensor data while your device does not have a network connection.

If you have Auto Upload enabled, you do not need to manually transfer sensor logs, as the logs are uploaded automatically when you have a WiFi or cellular (if selected) connection.

If you do not have Auto Upload enabled, you can manually transfer sensor logs.

Step 1. Collect Sensor Data

  1. Tap the menu icon and then tap Sensors.

  2. Turn on the sensor you want to collect data from using the toggle switch.

  3. If not already selected, tap Stream to and then select Log.

  4. To start collecting data, tap START.

  5. To stop collecting data, tap STOP.

  6. In the pop-up, accept the default name for the log file, or change the name, and tap Save.

    The default file name is sensorlog followed by the date and timestamp, for example, sensorlog_20180616_102034. In this example, the first four digits are the year, followed by two digits for the month and two digits for the day, which is June 16, 2018. The digits after the underscore are the time in hours, minutes, and seconds, which is 10:20 and 34 seconds in this example.

    The log is saved, and a visual indicator of the log appears on the sensor log button on the lower right of the screen. A red number on the icon indicates how many logs you have saved. The number increments as you collect and save more logs.

Repeat these steps to collect and save more data.

Step 2. Transfer Sensor Logs

Transfer sensor logs to your MATLAB® Drive™.

  • Auto Upload Sensor Logs

    Auto Upload must be enabled. If you have a network connection on your device, the log files are automatically uploaded to MATLAB Drive. If you do not currently have a network connection, the files will automatically upload the next time the device detects a network connection (WiFi or cellular, if selected).

  • Manually Transfer Sensor Logs

    If Auto Upload is off, you can manually upload the file to your MATLAB Drive. Tap Sensor Logs. Under Logs on Your Device, swipe left on the file you want to upload, and tap Upload.

While a file is uploading, a progress indicator spins next to the log name. When the upload is completed, a successful Cloud icon confirms it was uploaded to MATLAB Drive. If the file failed to upload, MATLAB Mobile™ displays a failed Cloud icon .

Logs are uploaded as MAT files to the default folder MATLAB Drive/MobileSensorData. You can change the upload folder by going to Sensors > More.

Sensor logs show automatically in your MATLAB Drive after a successful upload.

After logs are uploaded, you can access them in MATLAB Online™ or any product that connects to MATLAB Drive.

In MATLAB Online, go to the default folder, and use the load command to see the sensor data.

load('sensorlog_20180616_102034.mat')

You can run this command in MATLAB Mobile, too.

Delete Log Files

To delete sensor logs from your mobile device, tap Sensor Logs. Under Logs on Your Device, swipe left on the log file you want to delete, and tap Delete.

To delete log files from your MATLAB Drive, see Delete Files (MATLAB Mobile for iOS).

Related Topics