delete lines that contain NAN in a matlab matrix code example Example: remove nan matlab % Old B = A(~isnan(A)) % 2018b and above rmmissing(A)