MATLAB: Removing repeated values entirely from a vector vector Hello all, I have a vector that I want to have all repeated values completely removed. i.e if I had [1 1 2 3 4 4 5] i want to end up with just [2 3 5] Thanks Best Answer One approach:V = [1 1 2 3 4 4 5];[Vu,~,ic] = unique(V);T = accumarray(ic, 1);Out = Vu(T == 1)Out = 2 3 5 Related SolutionsMATLAB: How to remove unique values. Assuming that elements of A are integers greater or equal to 1, you could do something like: >> nonUniqueValues = find( accumarray(A.', ones(size(A))) > 1 ) nonUniqueValues = 1 3 4EDIT: we could also imagine an approach based on diff(sort(A))==0, but I prefer the approach above. MATLAB: Sort entire row b = sortrows(a,2); Related QuestionFinding duplicate number and adjacent row valueRemove redundancy values from matrixVector to repeated matrix multiplicationRemove repeating variables and replacing themRepeated values (multiple data points at the same location).
Best Answer