delete row in matrix if the row contain "Inf" value
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
LU Chongkai
am 12 Apr. 2020
Here is a way that don't change the original matrix:
B = A(any(~isinf(A),2),:)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!