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

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

a = [-2 -1 0 1 2]
isnan(1./a)
Warning: Divide by zero.
Thanks.

댓글을 달려면 로그인하십시오.

 채택된 답변

Friedrich
Friedrich 2014년 3월 24일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2014년 3월 24일

댓글:

2014년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by