Effacer les filtres
Effacer les filtres

How to delete row between a certain value in one column and a certain event in the second column?

2 vues (au cours des 30 derniers jours)
Hi all,
I have a matrix with two columns and millions of rows. The first column is time and the second one is events consisted of 0 or 1 only.
As an example, the matrix is: [560 0 ; 570 0; 580 0; 590 0; 600 0; 610 0; 620 0; 630 0; 640 1; 650 1; 660 0; 670 0; 680 0; 690 1; 700 0]
I would like to delete all the rows between 600s and the first time the event is 1, knowing that the first "1" event can never be < 600 s.
Thanks a lot for your help!

Réponse acceptée

Torsten
Torsten le 30 Mar 2022
Modifié(e) : Torsten le 30 Mar 2022
A= [560 0 ; 570 0; 580 0; 590 0; 600 0; 610 0; 620 0; 630 0; 640 1; 650 1; 660 0; 670 0; 680 0; 690 1; 700 0];
idx = find(A(:,1) >= 600);
jdx = find(A(idx,2) == 1,1,'first');
A(idx(1):idx(jdx)-1,:) = []

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by