eliminating NaN values from an array

1 visualización (últimos 30 días)
KalMandy
KalMandy el 10 de Nov. de 2016
Respondida: Steven Lord el 19 de En. de 2020
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 ]

Respuesta aceptada

Guillaume
Guillaume el 10 de Nov. de 2016
newarray = originalarray(~isnan(originalarray))

Más respuestas (2)

Sara Sahraoui
Sara Sahraoui el 18 de En. de 2020
Comment eliminer les nans sur data

Steven Lord
Steven Lord el 19 de En. de 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.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by