Log Sensor Data Locally

You can acquire sensor data locally on an Android™ 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 three dots icon and then tap Sensors.

  2. Tap the sensor you want to collect data from.

  3. 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_20190616_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, 2019. 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 Upload Sensor Logs

    If Auto Upload is off, or if you want to re-send a sensor log, you can manually upload the file to your MATLAB Drive.

    1. Go to the Sensor Logs screen by tapping the sensor log button at the bottom of the Sensors screen. The logs you have captured are listed there, with the most recent log listed first.

    2. In the files list, tap the menu on the file you want to transfer and select Upload.

While a file is uploading, a progress indicator spins next to the log name. When the upload is completed, a Cloud icon confirms it was successfully uploaded to MATLAB Drive.

Logs are uploaded as MAT files to the default folder MATLAB Drive/MobileSensorData. You can change the destination folder in Settings > Sensors > Configure > Upload Folder. 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.

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


Delete Log Files

To delete sensor logs from your mobile device, delete them from the Sensors screen:

  1. Tap the file icon on the Sensors screen.

  2. In the files list, tap the menu on the file you want to remove and then tap Delete.

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

Related Topics