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 and Sign In to the Cloud.
Start MATLAB
Mobile on your Android device.
On the Sensors of MATLAB
Mobile, tap the Magnetic Field
sensor.
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.
Begin logging data by enabling the Logging
property.
This action starts the transmitting of data from all selected
sensors. You can also start transmission by tapping the
Start button in MATLAB
Mobile on the device.
Get the logged magnetic field data.
This returns the magnetic field log, where mf
contains the three data points in X,
Y, and Z coordinates, in
microtesla.
See Device Orientation for a diagram showing the X,
Y, and Z axes relative to
the device.