Removing matrix rows after the first element of a row becomes too big

조회 수: 1 (최근 30일)
Sean
Sean 2014년 7월 14일
댓글: Sean 2014년 7월 14일
I want to remove all of the rows in A after the element of the first column of the nth row passes, say 10. Let A be
A = [ 1 1 1 1 1 1 1 1 1
3 3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4 4
7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8
10 10 10 10 10 10 10 10 10
11 11 11 11 11 11 11 11 11
25 25 25 25 25 25 25 25 25 ]
How do I do this without knowing what row the first element will be larger than 10 at?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 14일
편집: Azzi Abdelmalek 2014년 7월 14일
[ii,jj]=find(A>10,1);
A(ii:end,:)=[]

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by