I want my NaN values of one matrix to transfer over to a second matrix. Help!
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
alex
el 16 de Jul. de 2014
How would I go about doing this? For example I have two matrices of equivalent size:
[1 5 NaN 4 NaN 10 3]
[5 2 8 2 5 2 6]
I want my NaN values of the first matrix to replace the numbers in the second matrix, in the order in which they were located in the first matrix. My final result would look like:
[1 5 NaN 4 NaN 10 3]
[5 2 NaN 2 NaN 2 6],
where 8 and 5 of the second matrix were replaced by NaN.
Help please!
0 comentarios
Respuesta aceptada
Image Analyst
el 16 de Jul. de 2014
Try this:
a = [1 5 NaN 4 NaN 10 3]
b=[5 2 8 2 5 2 6]
b(isnan(a)) = nan
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre NaNs en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!