How to remove all rows with the same (specific) elements

4 ビュー (過去 30 日間)
Sean
Sean 2014 年 7 月 2 日
コメント済み: Sean 2014 年 7 月 2 日
If I have a, say 20x2 matrix, and I want to remove all rows with the entry 0 (column 1), 0 (column 2), how might I do that (and I want to be able to do it without having prior knowledge of the specific locations)?
M=[ 2 2
1 3
5 7
1 2
0 0
1 2
0 0 ]

採用された回答

Mischa Kim
Mischa Kim 2014 年 7 月 2 日
Sean, you could use something like
M(~any(M,2),:) = [];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by