Borrar filtros
Borrar filtros

how to replaces NaN's with a corresponding vector?

2 visualizaciones (últimos 30 días)
vedesh Mohit
vedesh Mohit el 2 de Abr. de 2018
Respondida: Walter Roberson el 2 de Abr. de 2018
I have two vectors x=[1 NaN 2 3 NaN 4 NaN NaN NaN 5 ]; y=[10 11 11 6 8 9 7 2 29 93 ]; I would like to know if there is a way to replace only the missing values (NaN's) in x with the corresponding value in the vector y?

Respuesta aceptada

Walter Roberson
Walter Roberson el 2 de Abr. de 2018
mask = isnan(x)
x(mask) = y(mask)

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB 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