How to delete nan from array

61 visualizzazioni (ultimi 30 giorni)
Hana
Hana il 13 Gen 2015
Commentato: Yang Liu il 4 Ago 2022
B=[nan 8 nan;6 nan nan;6 5 8] C=[nan 4 nan;4 nan nan;5 3 2]
Answer: B=[8 6 6 5 8] C=[4 4 5 3 2]

Risposta accettata

Guillaume
Guillaume il 13 Gen 2015
Modificato: Guillaume il 13 Gen 2015
B = B';
B = B(~isnan(B))';
C = C';
C = C(~isnan(C))';
  3 Commenti
Guillaume
Guillaume il 13 Gen 2015
Yes, not sure what I was thinking.
Yang Liu
Yang Liu il 4 Ago 2022
Why use '? Why not just B=B(~isnan(B))?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by