Using simple feature extraction to control lights

If I get 9 numbers from a 3x3 matrix, can you tell me how I can use those 9 numbers...

First, take your measurements in each axis (X, Y, and Z in the sensor coordinate frame - frame axes are usually labeled on the PCB) and subtract the 3 element bias vector. Then, take the unbiased measurement vector and apply the 3x3 matrix to get a fully calibrated measurement. To "apply the matrix", you have to do matrix multiplication where the calibrated measurement = 3x3 matrix * unbiased measurement.

NOTE: Order of operation matters when doing matrix multiplication!

Some (untested) code to make the explanation clearer (shamelessly ripped from this post):

// correction constants from Magneto

float M_B[3]
{ -922.31, 2199.41,  373.17};

float M_Ainv[3][3]
{ {  1.04492,  0.03452, -0.01714},
  {  0.03452,  1.05168,  0.00644},
  { -0.01714,  0.00644,  1.07005}
};
float Mxyz[3],temp[3];

...  
// get magnetometer data

  Mxyz[0] = imu.mx;
  Mxyz[1] = imu.my;
  Mxyz[2] = imu.mz;

//apply mag offsets (bias) and scale factors from Magneto

  for (int i = 0; i < 3; i++) temp[i] = (Mxyz[i] - M_B[i])

  Mxyz[0] = M_Ainv[0][0] * temp[0] + M_Ainv[0][1] * temp[1] + M_Ainv[0][2] * temp[2];
  Mxyz[1] = M_Ainv[1][0] * temp[0] + M_Ainv[1][1] * temp[1] + M_Ainv[1][2] * temp[2];
  Mxyz[2] = M_Ainv[2][0] * temp[0] + M_Ainv[2][1] * temp[1] + M_Ainv[2][2] * temp[2];