In MATLAB, hierarchical clustering produces a cluster tree or dendrogram by grouping data. A multilevel hierarchy is created, where clusters at one level are joined as clusters at the next level. From individual statistical units, the most closely related statistical units are aggregated at each iteration. In the Statistics and Machine Learning Toolbox, there is everything you need to do agglomerative hierarchical clustering. Using the pdist, linkage, and cluster functions, the clusterdata function performs agglomerative clustering. Finally, the dendrogram function plots the cluster tree.
As said, the procedure for forming the dendrogram requires the use of multiple functions. These functions are called by the clusterdata function, which represents the main function.
Analyzing the sequence of calls of these functions in detail can be particularly useful...