Clc, clear
Fidbench fopen('txt3.txt ', 'R ');
N1 = 6; n2 = 3;
A = [];
For I = 1: n1
Tmp = str2num (fgetl (fid ));
A = [a; tmp]; % read criterion layer Judgment Matrix
End
For I = 1: n1
Str1 = char (['B', int2str (I), '= [];']);
Str2 = char (['B', int2str (I), '= [B', int2str (I), '; tmp];']);
Eval (str1 );
For j = 1: n2
Tmp = str2num (fgetl (fid ));
Eval (str2); % judgment matrix of the read solution Layer
End
End
Ri = [0.58, 0.90, 1.12, 1.24, 1.32, 1.41, 1.45,]; % consistency indicator
[X, y] = eig ();
Lamda = max (diag (y ));
Num = find (diag (y) = lamda );
W0 = x (:, num)/sum (x (:, num); % w0 indicates that the feature vector is divided by the algebraic sum of the feature vector, indicating that the Hierarchical Single sorting
Cr0 = (lamda-n1)/(n1-1)/ri (n1) % indicates the consistency test of the criterion layer Judgment Matrix
For I = 1: n1
[X, y] = eig (eval (char (['B', int2str (I)]);
Lamda = max (diag (y ));
Num = find (diag (y) = lamda );
W1 (:, I) = x (:, num)/sum (x (:, num); % indicates the ranking of each judgment matrix in the solution layer, the hierarchical total sorting matrix equals to the criterion layer level single sorting multiplied by the scheme previous Hierarchical Single sorting
Cr1 (I) = (lamda-n2)/(n2-1)/ri (n2); % indicates the consistency test of each judgment matrix in the scheme Layer
End
Cr0, cr1, ts = w1 * w0, cr = cr1 * w0 % print out consistency test criteria and overall hierarchy sorting