I am using the mac version of Matlab R2013a (8.1.0.604) to perform 2D HCA and create a clustergram of the 2D HCA. I am also getting it to create a dendrogram at the same time. The code I am using is: data = xlsread('FCTonly') data = data(:,2:end) data = xlsread('FCTonly') samples = data(:,1) data = data(:,2:end) variables = xlsread('FCTonlylabels1') X=pdist(data,'euclidean') Y=linkage(X,'complete') Z=dendrogram(Y) Z=clustergram(data,'linkage', 'average', 'colormap', 'redbluecmap', 'rowlabels', samples)
The issue I am having, which didn't happen all the other times I have used this, is that the dendrogram for my samples is wrong on the clustergram. The dendrogram it creates when I use the code is correct and has the correct clusters on it but on the clustergram the dendrogram is different and has changed the clusters slightly. Does anyone know why the clustergram and dendrogram would be different as it has never done this before?

 채택된 답변

Adam
Adam 2014년 9월 18일
편집: Adam 2014년 9월 18일

0 개 추천

It's a while since I used the Hierarchical Clustering functionality, but isn't 'complete' linkage (used for your dendrogram) different to 'average' linkage (used for the clustergram)?
By the way, it is very useful if you can fill in the Product field and give sensible tags when asking a question. I have the Statistics toolbox and have used 'Dendrogram', but I don't have any 'Clustergram' functionality so where does that come from?

댓글 수: 2

Christopher Gallacher
Christopher Gallacher 2014년 9월 18일
Thanks for the reply. I changed from average to complete and it did what I wanted it to. I am not really that familiar with matlab so am using someone elses code and they must have made a mistake and never picked up on it.
cheers, Chris
Adam
Adam 2014년 9월 18일
No problem! It's a common problem with 3rd party code, especially if it isn't clearly documented, tested or validated.

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

추가 답변 (0개)

카테고리

질문:

2014년 9월 18일

댓글:

2014년 9월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by