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

78 ビュー (過去 30 日間)
Giuseppe
Giuseppe 2014 年 3 月 24 日
コメント済み: Giuseppe 2014 年 3 月 24 日
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 件のコメント
Rizwana
Rizwana 2014 年 3 月 24 日
a = [-2 -1 0 1 2]
isnan(1./a)
Warning: Divide by zero.
Giuseppe
Giuseppe 2014 年 3 月 24 日
Thanks.

サインインしてコメントする。

採用された回答

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by