How to eliminate rows with NaN elements?

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

 Accepted Answer

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

More Answers (0)

Asked:

on 21 Apr 2015

Answered:

on 21 Apr 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!