Question

I want the dendrogram of this data:

tt =  1.0e+03 *

Columns 1 through 5

3.8334    3.9707    3.8887    2.1713    2.5616

Columns 6 through 7

2.3764    2.4533

I use the code in matlab:

tree = linkage(tt,'average');
figure()
dendrogram(tree)

but it gives this error:

Error using linkage (line 137)

The first input does not appear to be a distance matrix because its size is not compatible with the output of the PDIST function. A data matrix input must have more than one row.

What's the problem
and i want the out put to be intervals.is the dendrogram output intervals?

Was it helpful?

Solution

The input to linkage is arranged with rows as observations and columns as variables, but in your example tt is a 1x7 row vector, suggesting a single observation at each of 7 variables. Instead, transpose tt to a column vector if this data represents 7 observations of a single variable, and you can then plot the dendrogram:

% your original tt variable
tt = 1.0e+03 .* [3.8334 3.9707 3.8887 2.1713 2.5616 2.3764 2.4533];
% transpose from row vector to column vector
tt = tt';
% proceed as planned
tree = linkage(tt,'average');
figure()
dendrogram(tree)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top