check if is nan matlab code example Example 1: if is nan matlab A(isnan(A))=1; Example 2: if is nan matlab if any(isnan(PMatrix), 'all')