Selecting rows based on criteria from previous row
이전 댓글 표시
Hello, I'm attempting to select specific rows of a matrix (size of which is (72,3) ) based on the criteria that the value of column 1 in the previous row = 0. So something
i = 1:72 X(i -1,1)==0? I've tried several different variations on this. I've also attempted naming rows with zero in the first column as something specific and selecting based on that, but can't seem to get it to work. Any help would be greatly appreciated it, thanks!
Sam DeWitt
답변 (1개)
Andrei Bobrov
2015년 11월 14일
편집: Andrei Bobrov
2015년 11월 14일
c - your array [72 x 3]
x = c(:,1) == 0;
out = c([false;x(1:end-1)],:);
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!