Magnetometers can be used to measure the magnetic fields around a device. You can access this data from qdex using an magnetometer tag. Magnetic fields are output in units of microteslas (one gauss is 100 microteslas). 

The magnetometer data is stored inside of an inherent vector called value inside of the onValueChanged event. As with simulations, qdex will not start to read magnetometer data until the magnetometer is started using the Start() method, or signaled from a simulation. 

In the following example, the values from the magnetometer are plotted and output to a label. 

You can copy this example into your document as-is. It must be contained in a section named section1.

<p name="myLabel" />

<magnetometer name="magnet">
    myLabel.Text = string.format("%d %d %d", value[1], value[2], value[3])

<simulation name="sim">
    if active then
      <signal ref="section1.magnet" width="3" />
      <probe ref="section1.magPlot" />

<timePlot name="magPlot" series="3" />