Getting rid of NaN from 1 by n matrix

2 visualizaciones (últimos 30 días)
Nathaniel
Nathaniel el 8 de Jun. de 2012
The matrix looks like this
[1,2,3,4,5,6,7,NaN,NaN......NaN]
The NaN are at the end of the matrix.
How do I get rid of those and turn this matrix into [1,2,3,4,5,6,7]?

Respuesta aceptada

Ryan
Ryan el 8 de Jun. de 2012
A =[1,NaN,2,3,NaN,4,5,NaN,6,7,NaN,NaN];
A(isnan(A)) = [];

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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