nan meaning in matlab code example Example 1: mean without nan matlab y = nanmean( X ) Example 2: if is nan matlab if any(isnan(PMatrix), 'all')