I am a new user to Matlab kmeans and have the following question:

I would like to use the following call from a Python application which is listed in this URL.

[idx, C] = kmeans(data, k)

Question 1: Do I need to allocate idx and C before this call to kmeans() or should I call the function without pre-allocation?

idx = []
C = [][]

[idx, C] = kmeans(data, k)

Question 2: After the call, can I manipulate idx array as well as C array independently?

In closing my source of confusion is [idx, C] implies one multi-dimensional array but dimensions of idx is "nx1" where n is the number of data points while dimension of C is two dimensional array [kX2]?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.