Well thanks. It's something I will be looking out for now

20 views (last 30 days)

When I ran the following three commands from the Statistics and Machine Learning Toolbox in the shown order, in my command window

Y = pdist(X)

Z - linkage(Y)

T = cluster(Z,'cutoff',1.2)

where X is 3042x53 matrix of type double, I get the following error (just after I execute statement 3) "Index in position 1 is invalid. Array indices must be positive integers or logical values." I then repeated these commands with a smaller X input (4x8). Same result. I believe that "cluster" wants integers for the first two columns of the Z input, (Z was produced by linkage) but the last column of Z is a distance measure and is real - so all columns of Z must be real. What am I doing wrong or misunderstanding?

Walter Roberson
on 24 Jan 2020 at 2:03

Z = linkage(squareform(Y)) ;

Walter Roberson
on 26 Jan 2020 at 1:45

Hmmm... I just realized that you might somehow have an existing variable named cluster

Walter Roberson
on 26 Jan 2020 at 2:06

It does happen a fair bit, most commonly with a variable named sum .

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.