Selecting rows based on criteria from previous row
Mostrar comentarios más antiguos
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
Respuestas (1)
Andrei Bobrov
el 14 de Nov. de 2015
Editada: Andrei Bobrov
el 14 de Nov. de 2015
c - your array [72 x 3]
x = c(:,1) == 0;
out = c([false;x(1:end-1)],:);
1 comentario
sam dewitt
el 14 de Nov. de 2015
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!