Split matrix into multiple matrices with same value

Let's say I have a matrix as with the following values:
A = [1 10
2 10
3 10
4 10
20 1
20 2
20 3
20 4];
then I would like to split this into two separate matrices:
B = [1 10
2 10
3 10
4 10];
C = [20 1
20 2
20 3
20 4];
A is just an example, there could be multiple occasions of the same x or y value. So after C is done there could be more values where either the x or the y value is the same. I want all occasions of same values, either x or y, to be split into a new matrix/new dimension of an existing matrix. Can this be done preferably without a loop? It doesn't really matter that much if it's in a loop though.

Answers (0)

Categories

Asked:

on 22 May 2017

Commented:

Jan
on 22 May 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!