MATLAB: Deleting nan rows in a matrix nan Hi, is there a simple method to delete the rows in which there is a nan in a matrix? I wrote the codes this way: [x1,y1]=find(isnan(AR1)); x1b=unique(x1); AR1(x1b,:)=[]; but I feel that I can delete these rows in a simpler way. Best Answer AR1(any(isnan(AR1),2),:) = []; Related SolutionsMATLAB: Removing all-NaN Rows/Columns from Cell Matrix A = { 0 2 'All' NaN NaN 2NaN NaN NaN NaN NaN NaNNaN NaN 'Yes' NaN NaN 1}idx=cellfun(@(x) all(isnan(x)),A)ii=all(idx,2)jj=all(idx)A(ii,:)=[]A(:,jj)=[] MATLAB: Deleting rows containing NaN Array(any(isnan(Array),2),:) = []; Related QuestionDelete NaN rows and columns butHow to delete nan from arrayAveraging Every 5 Elements in a Matrix for Each Column with NansSelect all Rows that Contain A Certain Number and Any NaN’s That follow ThemDelete rows with NaN recordsI want to delete a specific number of NaN in a matrix
Best Answer