MATLAB: How to delete all repeat rows MATLABmatrixrepeat How to delete all repeat rows? I mean all repeat rows, like : A= [0 4; 2 4; 0 4; 4 8; 3 4] How to got new_A= [2 4; 4 8; 3 4] Best Answer There is probably a more efficient way, but you can use unique() to get all first occurrences. Then you can use the second output to find all removed rows, which you can use as an input to setdiff.A=[0 4;2 4;0 4;4 8;3 4;0 4];[B,ind]=unique(A,'stable','rows');ind=setdiff(1:size(A,1),ind);B=setdiff(B,A(ind,:),'rows'); Related SolutionsMATLAB: Taking unique numbers of a set and order them with their respective number unique will be your friend:angle= [0; 1; 5; 3; 7; 8; 6; 9; 2; 4; 0];radius= [ 2; 4; 6; 7; 8; 9; 6; 4; 3; 3; 2];% unique angles and index of first occurence[uv,id,~] = unique(angle);% extractang = uvrad = radius(id) MATLAB: Hello, can any one help me out? I have an mxn matrix with repeated columns. How to get another matrix from this very one which is having no repetition of columns. Many thanks for anticipated assistance. Transpose your matrix, use unique with the rows option, and then transpose again:A=[2 3 4 4 3; 1 2 4 4 2; 2 4 6 6 4]B = unique(A.', 'rows','stable').' Related QuestionThe question is how to get the following formatCould anyone help me to solve the issueHow to substitute a row vector to a column of a matrixUsing the unique function to eliminate rows containing the same integers in a different order.Changing value when first time a value appears
Best Answer