フィルターのクリア

Doubt comparison of rows

1 回表示 (過去 30 日間)
FRANCISCO
FRANCISCO 2013 年 11 月 6 日
回答済み: Andrei Bobrov 2013 年 11 月 6 日
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

採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 11 月 6 日
A = [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];
delta = A(1:2:end) - A(2:2:end,:)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by