MATLAB: How to eliminate rows with NaN elements

deletematrixnanrow

If there is at least one NaN value in a row, I would like to delete that row from my matrix.

Best Answer

rows = any(isnan(myMatrix),2);
myMatrix(rows,:) = [];