Documentation

disp

Display properties of mobiledev object

Syntax

Description

example

disp(m) displays properties of m, the mobiledev object created to acquire sensor data from Android™ devices. You can call the function any time during your mobiledev session, and the display varies depending on the state of the sensors.

Examples

collapse all

This example assumes that you have already installed and set up MATLAB® Mobile™ on your Android device and connected it to your computer running MATLAB. For information about these steps, see Install MATLAB Mobile on Your Android Device (MATLAB Mobile for Android) and Sign In to the Cloud (MATLAB Mobile for Android).

Start MATLAB Mobile on your Android device.

On the Sensors screen of MATLAB Mobile, tap the sensors that you want to send data from.

Place the device where you want to get the sensor data, if a remote location.

On your computer, create a mobiledev object, m, in MATLAB.

m = mobiledev
m = 
mobiledev with properties:

                   Connected: 1
           Available Cameras: {'back' 'front'}
                     Logging: 0
            InitialTimestamp: ''

   AccelerationSensorEnabled: 1
AngularVelocitySensorEnabled: 1
       MagneticSensorEnabled: 1
    OrientationSensorEnabled: 1
       PositionSensorEnabled: 1

Supported functions

In the display that is shown when you create the object, a value of 1 means enabled or on, and 0 means not enabled or off. The InitialTimestamp property is empty because no data has been logged yet. It represents the time when the first data point was transferred from the device to the mobiledev object.

Begin logging data from the selected sensors by enabling the Logging property.

m.Logging = 1

You can use disp at any time to see the status of the sensors and logging, and the current sensor values.

disp(m)
mobiledev with properties:

                   Connected: 1
           Available Cameras: {'back' 'front'}
                     Logging: 1
            InitialTimestamp: '06-08-2014 13:45:56.529'

   AccelerationSensorEnabled: 1   (1000 Logged values) 
AngularVelocitySensorEnabled: 1   (1200 Logged values) 
       MagneticSensorEnabled: 1   (1005 Logged values) 
    OrientationSensorEnabled: 1   (1030 Logged values) 
       PositionSensorEnabled: 1   (800 Logged values) 

Current Sensor Values:
                Acceleration: [0.27 0.23 -10.19]  (m/s^2) 
             AngularVelocity: [-0.22 0.07 0.06]  (rad/s) 
               MagneticField: [3.56 1.56 -48.19]  (microtesla) 
                 Orientation: [85.91 -27.1 0.35]  (degrees) 

        Position Data:
                    Latitude: 41.29  (degrees) 
                   Longitude: -72.35  (degrees) 
                       Speed: 25.00  (m/s) 
                      Course: 83.60  (degrees) 
                    Altitude: 42.10  (m)
          HorizontalAccuracy: 9.00  (m) 
                                            
 Supported functions

This display now shows that logging is enabled, and the initial timestamp is filled in, representing the timestamp when logging started. The sensor properties show the log size — how many values were logged when you called the disp function. If you call the function again in the same session, you see an increased number of logged values. The current sensor values show the values at the point of the display. In this way, you can use disp any time to check the values.

If any of the sensors are delayed in sending data, the display indicates that. For example, if the Position sensor has a lag, the position data values appear as follows:

disp(m)
mobiledev with properties:

                   Connected: 1
           Available Cameras: {'back' 'front'}
                     Logging: 1
            InitialTimestamp: '06-08-2014 13:45:56.529'

   AccelerationSensorEnabled: 1   (1000 Logged values) 
AngularVelocitySensorEnabled: 1   (1200 Logged values) 
       MagneticSensorEnabled: 1   (1005 Logged values) 
    OrientationSensorEnabled: 1   (1030 Logged values) 
       PositionSensorEnabled: 1   (0 Logged values) 

Current Sensor Values:
                Acceleration: [0.27 0.23 -10.19]  (m/s^2) 
             AngularVelocity: [-0.22 0.07 0.06]  (rad/s) 
               MagneticField: [3.56 1.56 -48.19]  (microtesla) 
                 Orientation: [85.91 -27.1 0.35]  (degrees) 

        Position Data:
                    Latitude: [0x3 double] (Waiting for data) 
                   Longitude: [0x3 double] (Waiting for data) 
                       Speed: [0x3 double] (Waiting for data) 
                      Course: [0x3 double] (Waiting for data) 
                    Altitude: [0x3 double] (Waiting for data)
          HorizontalAccuracy: [0x3 double] (Waiting for data) 
                                                                 
 Supported functions

When the Position sensor starts sending data, subsequent uses of disp would show the values.

Stop logging data from the selected sensors by disabling the Logging property.

m.Logging = 0

This action stops the transmitting of data from all selected sensors. You can also stop transmission by tapping the Stop button in MATLAB Mobile.

When you stop logging data, the display shows the log size, but no current data.

disp(m)
mobiledev with properties:

                   Connected: 1
           Available Cameras: {'back' 'front'}
                     Logging: 0
            InitialTimestamp: '06-08-2014 13:45:56.529'

   AccelerationSensorEnabled: 1   (3000 Logged values) 
AngularVelocitySensorEnabled: 1   (3200 Logged values) 
       MagneticSensorEnabled: 1   (3005 Logged values) 
    OrientationSensorEnabled: 1   (3030 Logged values) 
       PositionSensorEnabled: 1   (2400 Logged values) 

 Supported functions

Notice that the Logging property changes back to disabled by showing a 0. The log sizes are the final number of values in the log session, for example, 3000 values from the Acceleration sensor. But the current values are no longer shown since you are no longer logging data.

Introduced in R2014b