Effacer les filtres
Effacer les filtres

finding NON in matrix

1 vue (au cours des 30 derniers jours)
rahman
rahman le 24 Mai 2011
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 commentaires
Sean de Wolski
Sean de Wolski le 24 Mai 2011
Do you mean NaN?
rahman
rahman le 24 Mai 2011
Oops!!
that a really big mistake!
yes, NON means NaN ;)

Connectez-vous pour commenter.

Réponse acceptée

Laura Proctor
Laura Proctor le 24 Mai 2011
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;
  1 commentaire
rahman
rahman le 24 Mai 2011
tnx lot

Connectez-vous pour commenter.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 24 Mai 2011
A(isnan(A)) = 0;
  1 commentaire
Walter Roberson
Walter Roberson le 24 Mai 2011
You're fast today, Sean!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by