delete row in matrix if the row contain "Inf" value
17 次查看(过去 30 天)
显示 更早的评论
Let's say:
A=[1 2 3 5
2 Inf Inf Inf ---->delete this row
3 1 7 5
9 Inf Inf Inf ---->delete this row
11 3 45 91 ]
Question: If i want to delete the row contain "Inf", how can I do that?
result_A=[1 2 3 5
3 1 7 5
11 3 45 91 ]
0 个评论
采纳的回答
更多回答(2 个)
LU Chongkai
2020-4-12
Here is a way that don't change the original matrix:
B = A(any(~isinf(A),2),:)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!