I have a 50x3 matrix with numerical values. I want to take all the rows that have 2 zeros or more out For example
0 25 15;
0 0 25;
16 13 12
I only want to get out the first and the third row. And I do not wish to do that manually with 50 rows.

 採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 4 月 30 日

0 投票

a = [0 25 15;
0 0 25;
16 13 12];
out = a(sum(a == 0,2) < 2,:)

1 件のコメント

ieva ashmore
ieva ashmore 2017 年 4 月 30 日
Thank you. That we nice, clean and easy one line solution.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by