MATLAB: Selection of row from a matrix

selection of row from a matrix

i have a matrix,and i want remove that row in which numbers repeated
A= [3 5 5
6 9 1
7 5 7
2 4 6];
Ans: A=[6 9 1;2 4 6]
i used "for loop" for this problem, i want to ask there is any direct command to find the Ans. pls give me the suggestion…..

Best Answer

Post the question at Cody:). It's a little exercise with logicl indexing.
>> A( any( diff( sort( A, 2 ), 1, 2 ) == 0, 2 ), : ) = []
A =
6 9 1
2 4 6
>>