Extracting data from a matrix

1 回表示 (過去 30 日間)
ieva ashmore
ieva ashmore 2017 年 4 月 29 日
コメント済み: ieva ashmore 2017 年 4 月 30 日
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 日
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 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by