How can I find pairs of rows with the same values in certain columns?
이전 댓글 표시
For a (very) huge data set in form of a 350000x11 matrix I need to find pairs of rows
- with identical values in columns 1,6 and 7 and
- with a different value in column 10 (dummy variable, either 0 or 1)
and calculate the difference in column 11 for each pair matching the above mentioned conditions. Using a for loop I only managed to compare consecutive rows:
[m,n] = size(X)
for i=1:m-1
if X(i,1) == X(i+1,1) && X(i,6) == X(i+1,6) && X(i,7) == X(i+1,7) && X(i,10) ~= X(i+1,10)
X(i,11)-X(i+1,10)
end
end
Any ideas? Thank you in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!