Objects names in dendrogram

조회 수: 4 (최근 30일)
Diego
Diego 2012년 10월 10일
Hello, I didn't find a way for labeling the objects in a dendrogram.
The code I'm using is like this:
A = dataset('XLSFile','MyExcelFile.xlsx');
MyVars = double(A(:,{'Var1', 'Var2', 'Var3'}));
clustVars = pdist(MyVars,'euclidean');
linkVars = linkage(clustVars,'average');
[h,nodes] = dendrogram(linkVars,0);
  1. Load the Excel file into a dataset array
  2. Create a double-precision array containing the variables
  3. Compute the Euclidean distance
  4. Execute the clustering method
  5. Draw the dendrogram
In my dataset array A I have a variable that contains the names of the vectors.
Of course I can't include that variable in the analysis.
Can somebody explain me how to label the objects in a cluster analysis using that variable, let's call it objNames?
Thanks in advance,
Diego
  댓글 수: 3
Diego
Diego 2012년 10월 10일
편집: Diego 2012년 10월 10일
... and this way seems to be better for clarity:
[h,nodes] = dendrogram(linkVars,'colorthreshold','default');
find(nodes==29)
How can I add the names of the objects directly with the find function?
Diego
Diego 2012년 10월 10일
Well this seems to work good enough:
A = dataset(find(nodes),nodes,S)
sortrows(A,2)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by