Splitting a list based on another list values in Mathematica
Posted
by Max
on Stack Overflow
See other posts from Stack Overflow
or by Max
Published on 2010-04-22T23:16:25Z
Indexed on
2010/04/22
23:23 UTC
Read the original article
Hit count: 179
mathematica
|list
In Mathematica I have a list of point coordinates
size = 50;
points = Table[{RandomInteger[{0, size}], RandomInteger[{0, size}]}, {i, 1, n}];
and a list of cluster indices these points belong to
clusterIndices = {1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1};
what is the easiest way to split the points into two separate lists based on the clusterIndices values?
© Stack Overflow or respective owner