Extracting data points from a matrix and saving them in different matrixes in MATLAB
Posted
by Hossein
on Stack Overflow
See other posts from Stack Overflow
or by Hossein
Published on 2010-05-30T13:20:49Z
Indexed on
2010/05/30
13:42 UTC
Read the original article
Hit count: 224
Hi, I have a 2D Matrix consisting of some coordinates as below(example): Data(X,Y):
45.987543423,5.35000964
52.987544223,5,98765234
Also I have an array consisting of some integers >=0 , for example: Cluster(M)
2,0,3,1
each of these numbers in this array corresponds with a row of my 2D Matrix above.For example, it says that row one(coordinate) in the Data Matirx belongs to the cluster 2,second row belongs to cluster 0 and so on. Now I want to have each of the datapoint of each cluster in a separate matrix, for example I want to save datapoints belonging to cluster 1 in a separate matrix, cluster 2 in a separate matrix and so on,.... I can do them manually, but the problem is this has to be an automatic extraction. which means that the number of clusters(range of the numbers in the cluster array varies in each run) so I have to have a general algorithm that does this extraction for me. Can someone help me please? thanks
© Stack Overflow or respective owner