removing rows from matrix which equal particular number
조회 수: 2 (최근 30일)
이전 댓글 표시
A=[1 2 3;4 5 6;99 7 8;5 5 99;1 2 3;99 99 5];
How can I remove rows include 99 as follows;
B=[1 2 3;4 5 6;1 2 3];
The actual matrix is much more, the above is just an example.
댓글 수: 0
채택된 답변
Adam Danz
2018년 7월 26일
The first line identifies rows of A that have 99. The second line removes those rows.
removeIdx = any(A == 99, 2);
A(removeIdx,:) = []
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!