eliminating NaN values from an array

1 vue (au cours des 30 derniers jours)
KalMandy
KalMandy le 10 Nov 2016
Hi, does someone know how to eleiminate NaN values from an array? For example I have an array [NaN 0.6451 NaN 0.8339 0.8015 ], I want to make it [0.6451 0.8339 0.8015 ]

Réponse acceptée

Guillaume
Guillaume le 10 Nov 2016
newarray = originalarray(~isnan(originalarray))
  1 commentaire
KalMandy
KalMandy le 10 Nov 2016
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (2)

Sara Sahraoui
Sara Sahraoui le 18 Jan 2020
Comment eliminer les nans sur data

Steven Lord
Steven Lord le 19 Jan 2020
In newer releases you can use rmmissing to remove missing data (NaN for double and single precision data, <undefined> for categorical arrays, etc.) There are other functions for working with missing data like fillmissing listed on this documentation page.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by