How does one equate say 5 least values in a row of matrix to NaN and have them reflected in the original matrix and not the sorted one. For example;
A = rand(10,10)[srt, idx] = sort(A(10,:),'ascend');srt(1:5)=NaN;idx(1:5)=NaN;A(10,:) = srt
This works fine but the NaN values only apply in the sorted A. I want them to be reflected according to the index in the original Matrix
Best Answer