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

조회 수: 2 (최근 30일)
Zona Hrnjak
Zona Hrnjak 2019년 7월 9일
편집: Matt J 2019년 7월 10일
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?

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by