MATLAB Answers

# Find first three numbers in a matrix that satisfy the condition x>0.001

1 view (last 30 days)
Zona Hrnjak on 9 Jul 2019
Edited: Matt J on 10 Jul 2019
I have a matrix with three columns and just over 8000 rows. The first column is the load in a compression test as time goes on. I want to find where the numbers start increasing actually increasing, so I want to find the first three numbers which are greater than or equal to 0.001. I've used the following to find the rows where x>0.001:
B=find(A(:,1)>0.001)
However, I don't know how to specifiy to find the first three rows that satisfy these conditions. Any ideas on how to go about this?

#### 0 Comments

Sign in to comment.

### Accepted Answer

Matt J on 9 Jul 2019
B=find(A(:,1)>0.001,3)

#### 2 Comments

Zona Hrnjak on 9 Jul 2019
Is there a way to get the first three rows that both satisfy the condition and are next to each other?
Matt J on 10 Jul 2019
B=A(:,1)>0.001;
C=B(1:end-2)&B(2:end-1)&B(3:end);
result = find(C,1)

Sign in to comment.

### More Answers (0)

Sign in to answer this question.

R2019a