How to filter rows with respect to specific entry?

1 次查看(过去 30 天)
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 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by