MATLAB: detect and remove mirror imaged pairs in 2 column matrix
问题 I have a matrix [1 2 3 6 7 1 2 1] and would like to remove mirror imaged pairs..i.e. output would be either: [1 2 3 6 7 1] or [3 6 7 1 2 1] Is there a simple way to do this? I can imagine a complicated for loop, something like (or a version which wouldn't delete the original pair..only the duplicates): for i=1:y var1=(i,1); var2=(i,2); for i=1:y if array(i,1)==var1 && array(i,2)==var2 | array(i,1)==var2 && array(i,2)==var1 array(i,1:2)=[]; end end end thanks 回答1: How's this for simplicity - A