We present a quick and easy method for the calibration of a matrix of sensors. The algorithm is based on a three-step irradiation procedure which relies only on the constancy of the delivered fluence at each step. With this method the gain of each sensor is derived relative to a reference detector. The algorithm has been applied to a matrix of (32 x 32) ionization chambers. After the calibration coefficients have been applied, by comparing the response of the matrix of chambers to a reference detector over a large field, we determined that the fluence measurement of individual chambers is better than 0.7%. The algorithm solves the cumbersome problem of the relative gain calibration of a matrix of a large number of sensors.