Based on the idea of the immune algorithm, an immune recognition OR) method was proposed to obtain the principal factor number of a data matrix. The original matrix is input to the algorithm as antigens, a number of antibodies are generated by means of PCA, elimination of antigens is performed in a recurrence procedure. An equation for the calculation of the affinity value is defined. In each elimination I an affinity value is calculated. According to the series of the calculated affinity values, the principal factor number of the matrix can be obtained. By the tests of both simulated and experimental HPLC-DAD data, the IR method showed the superiority over the imbedded error (IE), the factor indicator function (IND) and the cross validation (M. In treating experimental HPLC-DAD data, due to the interference of the nonlinearity and the heteroscedastic noise, only IR can obtain the correct factor number, none of IE, IND or CV succeeded.