From: Wayne King on
"Natalie Sin Hwee " <sin.ng09(a)imperial.ac.uk> wrote in message <i248bi$n9k$1(a)fred.mathworks.com>...
> Dear Mathwork users,
> I have a 6000x2 matrix:
>
> 1 88
> 1 67
> 2 31
> 2 30
> 2 88
> 2 65
> 3 31
> 3 61
> 3 71
> 3 79
>
> etc.
>
> and sometimes the rows will have 'mirrored' similarities
> eg.
>
> 1 88
>
> and further down...
> 88 1
>
> In this case, is there any suggestions to remove the second pair (i.e. 88 1) because they are practically the same from node1->88 and node 88->1
>
> ^^ thank you lots ^^
> Natalie :)

Hi Natalie, One of many ways:

X = [1 88
1 67
2 31
2 30
2 88
2 65
3 31
3 61
3 71
3 79
88 1];
[C,IA,IB] = intersect(X,fliplr(X),'rows');
X(IA(2),:)=[];

Hope that helps,
Wayne
 | 
Pages: 1
Prev: while loop
Next: concatenate arrays