MATLAB: Remove redundancy values from matrix matrix Any possible to remove the duplicate entries S=[2 3 4 5 4 4 4;2 3 4 2 3 4 5;3 4 4 5 5 2 3]; I want the output will be A=[2 3 4 5] Best Answer S=[2 3 4 5 4 4 4;2 3 4 2 3 4 5;3 4 4 5 5 2 3];S1 = unique(S); Related SolutionsMATLAB: Remove repeating variables and replacing them x = x([true diff(x)~=0]) MATLAB: 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. Related QuestionPutting the combinations of a sequence in an cell arrayRedundancy analysis with matlabWhat is command for circularly writing a row matrix in matlabRemoving repeated values entirely from a vectorGiven a=[1 2 3 4 5], generate m=[2 1 3 4 5; 2 3 1 4 5; 2 3 4 1 5; 2 3 4 5 1; 1 3 2 4 5; 1 3 4 2 5; 1 3 4 5 2; 1 2 4 3 5; 1 2 4 5 3; 1 2 3 5 4].
Best Answer