I have a problem where I have to remove duplicates from a column without using unique and without sorting the data. My current code is able to remove duplicates without unique, but the data has to be sorted for it to work. Is there a way to remove the duplicates without sorting and without using unique?
z = length(A);for i = 1:(z-1) if A(i+1) == A(i) A(i) = A(i) - A(i+1); endendA(A==0) = [ ]; end
Best Answer