Find Rows in MAtrix that have NAN values and delete them
matlab
Solution
rates(any(isnan(rates), 2), :) = [];
Alternatively:
rates = rates(~any(isnan(rates), 2), :);
I think the second approach is faster.
Problem
Possible Duplicate: MATLAB: How To Efficiently Remove NaN Elements from Matrix I got code that does it below but its a little slow (the matrix is big) is there a better way to do it? ``` errorMat=isnan(rates); errorRows=ind(errorMat); for i=1:length(errorRows) rates(:,errorRows(i)) = []; end ```