removing rows from matrix which equal particular number

2 ビュー (過去 30 日間)
sermet
sermet 2018 年 7 月 26 日
回答済み: Adam Danz 2018 年 7 月 26 日
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.

採用された回答

Adam Danz
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 件)

カテゴリ

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by