I'm trying to check for a NaN value in an array in if condition expression but the control is not entering inside if condition.
조회 수: 1 (최근 30일)
이전 댓글 표시
For example :
A = [1 2 3 NaN 3 5]; if isnan(A) ~= 0 %... end
댓글 수: 0
채택된 답변
KSSV
2017년 10월 12일
A = [1 2 3 NaN 3 5];
idx = isnan(A) ; % all NaN indices at once
for i = 1:length(A)
if isnan(A(i))
fprintf('%d index value is NaN\n',i)
end
end
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!