# MATLAB: Doubt comparison of rows

MATLABstatistics

I have the following array and I want to compare column 7 elements of this matrix. I want to compare
– (1,7) to (2,7) – (3.7) with (4.7)
and so on but considering that the initial matrix dimensions may change:
0 0 0 0 97790 0.0652150716905635
0 0 0 1 94450 0.0629876625541847
0 0 1 0 94954 0.0633237745915305
0 0 1 1 91739 0.0611797265755252
1 0 1 0 94135 0.0627775925308436
1 0 1 1 91051 0.0607209069689897
1 1 0 0 95302 0.0635558519506502
1 1 0 1 92901 0.0619546515505168
1 1 1 0 92341 0.0615811937312437
1 1 1 1 89610 0.0597599199733244
for this I tried to use the following code:
if true  % code
n)length(X);
for i=1:n;
if X(i,6) < X(i+1,6);
jj(i)=1;
else jj(i)=0;
end
end
end
But I do not operate correctly because I want to compare rows 1 to 2, the 3 and the 4, the 5 with the 6th …..
Many thanks

#### Best Answer

• A = [0 0 0 0 97790 0.06521507169056350 0 0 1 94450 0.06298766255418470 0 1 0 94954 0.06332377459153050 0 1 1 91739 0.06117972657552521 0 1 0 94135 0.06277759253084361 0 1 1 91051 0.06072090696898971 1 0 0 95302 0.06355585195065021 1 0 1 92901 0.06195465155051681 1 1 0 92341 0.06158119373124371 1 1 1 89610 0.0597599199733244];delta = A(1:2:end) - A(2:2:end,:)