finding NON in matrix

Hi all In the matrix A which is 1*N matrix, I want to recognize if there is any element equal to NON in it,I replace it by zero.How can I do that?

2 comentarios

Sean de Wolski
Sean de Wolski el 24 de Mayo de 2011
Do you mean NaN?
rahman
rahman el 24 de Mayo de 2011
Oops!!
that a really big mistake!
yes, NON means NaN ;)

Iniciar sesión para comentar.

 Respuesta aceptada

Laura Proctor
Laura Proctor el 24 de Mayo de 2011

0 votos

I'm going to assume that you mean NaN. You can use the ISNAN function to find and replace the NaNs in your code. Here's an example:
A = randn(1,100);
A([2,10,23,47,88]) = NaN;
A(isnan(A)) = 0;

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 24 de Mayo de 2011

0 votos

A(isnan(A)) = 0;

Categorías

Preguntada:

el 24 de Mayo de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by