nan problem

1 visualización (últimos 30 días)
x
x el 8 de Oct. de 2011
any ways to remove NAN in the final results
  1 comentario
Walter Roberson
Walter Roberson el 9 de Oct. de 2011
Duplicate is at http://www.mathworks.com/matlabcentral/answers/16221-nan-value

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 8 de Oct. de 2011
A very vague question. I guess the answer is: yes.
x = [1, NaN, 3];
x(isnan(x)) = [];
  6 comentarios
Jan
Jan el 8 de Oct. de 2011
@x: An explicite example would be much easier to understand.
If your results contain some 0/0==NaN values, it is your turn to define what should happen in this case. It is impossible for us to guess, what a good replacement could be, because this depends on your problem.
Perhaps: x(isnan(x)) = 0, or x(isnan(x)) = -1000, or whatever.
If you plot the results NaN's are often treated very handy, because they are not drawn. See:
plot([1:10, NaN, 11:16]);
Andrei Bobrov
Andrei Bobrov el 8 de Oct. de 2011
Hi Jan!
x = x(~isnan(x))

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Identification 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!

Translated by