Selecting rows based on criteria from previous row
Ältere Kommentare anzeigen
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
Antworten (1)
Andrei Bobrov
am 14 Nov. 2015
Bearbeitet: Andrei Bobrov
am 14 Nov. 2015
c - your array [72 x 3]
x = c(:,1) == 0;
out = c([false;x(1:end-1)],:);
1 Kommentar
sam dewitt
am 14 Nov. 2015
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!