I am looking for a way to remove the NaN numbers from a matrix in MATLAB efficiently (i.e. without using a for loop)
I will provide a quick example to illustrate wha
The best way is
M(any(isnan(M),2),:)=[]
which will remove any row that contains at least one NaN.