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에 대해 자세히 알아보기

태그

질문:

2017년 4월 29일

댓글:

2017년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by