readMobileSensorData

Import sensor data from file collected by MATLAB Mobile

Syntax

s = readMobileSensorData('filename')

Description

example

s = readMobileSensorData('filename') reads the file, filename, extracts the sensor data from it, and creates a structure, s, where each field in the structure is a timetable with the sensor data. The file contains sensor data collected by MATLAB Mobile locally on a mobile device.

This function is required only when you manually transfer a sensor log file from a mobile device to your computer using a USB cable. If you upload the sensor file from the mobile device to MATLAB Drive, you do not need to use this function.

Examples

collapse all

Use of this function is the last step in a workflow in which you log sensor data locally on your mobile device using the Sensors tab in MATLAB Mobile, and then transfer the log file manually to your computer using a USB cable. The function then imports the sensor data into MATLAB. These steps are outlined in Acquire Sensor Data Locally on Mobile Device (MATLAB Mobile for iOS).

Import a sensor log that you previously created on MATLAB Mobile, and manually transfer it to your computer.

s = readMobileSensorData('sensorlog_20180726_102034.zip')

The structure, s, is created and contains sensor data from up to five supported sensor types.

You can then access data from any of the sensors. For example, create a variable for the acceleration data.

acceleration = s.Acceleration;

Plot the acceleration data.

plot(acceleration.Timestamp, acceleration{:, 2:end})

Input Arguments

collapse all

Name of sensor data file, specified as a string. This file is created when you log sensor data locally using the Sensors tab in MATLAB Mobile on your mobile device. The default file name is sensorlog followed by the date and timestamp, as shown in the example here. You can change the file name when you log the data in MATLAB Mobile.

Example: s = readMobileSensorData('sensorlog_20180616_102034.zip')

Data Types: char | string

Output Arguments

collapse all

Sensor data collected on MATLAB Mobile, retuned as a structure. The readMobileSensorData function extracts the sensor data from the file and creates the structure, in which each field is a timetable with the sensor data collected by MATLAB Mobile locally on a mobile device.

The structure contains one or more of the following fields. If you collected data from only one sensor, it contains data from only that sensor.

  • Acceleration - timetable with acceleration data

  • AngularVelocity - timetable with angular velocity data

  • MagneticField - timetable with magnetic field data

  • Orientation - timetable with orientation data

  • Position - timetable with position data

See Also

Topics

Introduced in R2018b