How do I check if any elements are not a number in a matrix.

79 vues (au cours des 30 derniers jours)
Giuseppe
Giuseppe le 24 Mar 2014
Commenté : Giuseppe le 24 Mar 2014
I want to check that the matrix I have contains any non numbers in it. I guess I would use the any() function? I just don't know what code to use.
  2 commentaires
Rizwana
Rizwana le 24 Mar 2014
a = [-2 -1 0 1 2]
isnan(1./a)
Warning: Divide by zero.
Giuseppe
Giuseppe le 24 Mar 2014
Thanks.

Connectez-vous pour commenter.

Réponse acceptée

Friedrich
Friedrich le 24 Mar 2014
Hi,
I think you are looking for isfinite. (isNaN covers NaN values only but isfinte covers NaN as well as Inf).

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by