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