Extract clusters info from dendrogram as a matrix

15 views (last 30 days)
Robert
Robert on 6 Jan 2018
Commented: Robert on 12 Jan 2018
Hello,
Wondering if somebody could guide me here...
I do have data from instruments at different locations (Latitude and Longitude) and depths, and I need to cluster these based on their proximity, and I can do that fine, but I also need to extract the info from the clusters for another analysis.
This is a very short example of my data:
ID Depth Lat Lon
A1 0.33 -14.28 -170.56
A2 2 -14.24 -169.42
A3 15 -14.33 -170.83
A4 14.95 -11.06 -171.09
A5 17 -14.28 -170.72
A6 14.8 -0.38 -160.02
A7 1.5 5.87 -162.05
A8 0.33 -0.38 -160.02
A9 12.8 -0.38 -160.02
A10 2.8 -0.38 -160.02
A11 7 -0.38 -160.02
A12 9.8 -0.38 -160.02
A13 10 -0.38 -160.02
This is the result of using the function dendrogram, with a line at 150 (x-axis), which represent the cluster max cut that I want to apply based on the data I have. </matlabcentral/answers/uploaded_files/100362/test.jpg>
What I need is to extract the clusters in a way similar to this:
Cluster ID Depth Lat Lon
1 A7 1.5 5.87 -162.05
2 A8 0.33 -0.38 -160.02
2 A11 7 -0.38 -160.02
3 A12 9.8 -0.38 -160.02
3 A13 10 -0.38 -160.02
3 A9 12.8 -0.38 -160.02
3 A6 14.8 -0.38 -160.02
4 A4 14.95 -11.06 -171.09
5 A3 15 -14.33 -170.83
6 A5 17 -14.28 -170.72
7 A1 0.33 -14.28 -170.56
8 A2 2 -14.24 -169.42
Thank you for your suggestions and/or directions to an existent answer, if that is the case.

Accepted Answer

Kris Fedorenko
Kris Fedorenko on 8 Jan 2018
Hello Robert,
I am unable to see the image, but sounds like you might find functions like cluster or clusterdata useful.
Are you creating a dendrogram from a binary tree, specified as an (M – 1)-by-3 matrix (e.g. generated with the linkage function)? Then you can just pass on the same matrix to the "cluster" function.
  2 Comments
Robert
Robert on 12 Jan 2018
Thank you so much Kris, for all of your help with this question and follow-ups. I really appreciated it!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!