Split matrix into multiple matrices with same value
Afficher commentaires plus anciens
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.
1 commentaire
Jan
le 22 Mai 2017
What happens for:
A = [1, 2; ...
1, 3; ...
2, 3, ...
2, 4]
?
Réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!