How to filter rows with respect to specific entry?

조회 수: 12 (최근 30일)
Ammy
Ammy 2018년 3월 10일
댓글: Ammy 2018년 3월 10일
I have thousands of rows and I want to filter those rows in which the entry at third position is three
For example
A=[1 2 3 4 5 6 7 8 9;0 1 2 3 4 5 6 7 8 9 10;5 6 3 2 1 4 7 8 9];
I want the resulting matrix
AA=[1 2 3 4 5 6 7 8 9;5 6 3 2 1 4 7 8 9]
Thanks
  댓글 수: 1
dpb
dpb 2018년 3월 10일
>> A=[1 2 3 4 5 6 7 8 9;0 1 2 3 4 5 6 7 8 9 10;5 6 3 2 1 4 7 8 9];
Dimensions of matrices being concatenated are not consistent.
>>

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

채택된 답변

dpb
dpb 2018년 3월 10일
>> A=[1 2 3 4 5;0 1 2 3 4;5 6 3 2 1];
>> A(A(:,3)==3,:)
ans =
1 2 3 4 5
5 6 3 2 1
>>

추가 답변 (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