Hello, I am trying to run K means clustering to group different types of clusters in my purchase order history. B represent a 16004 x 4 matrix and A represents a combination of 5 16004 x 1 matrixs. I am attempting to run the script below to view the different clusters.
A = table2cell([Age, Gender, City, Date, Product_ID])
B = cell2mat(A);
IDK = kmeans(B,4)
for k1 = 1:16004
text(B(:,1),B(:,2),B(:,3),B(:,4),B(:,5),num2str(IDK(k1))); hold on;
end
However an error continues to read
Error using text
Too many non-property/value arguments.
Please help! Thank you.

 Respuesta aceptada

Image Analyst
Image Analyst el 23 de Nov. de 2016

0 votos

Maybe you want fprintf() instead????
fprintf('%f, %f, %f, %f, %f, %f\n', ...
B(:,1),B(:,2),B(:,3),B(:,4),B(:,5), IDK(k1));

Más respuestas (1)

Walter Roberson
Walter Roberson el 23 de Nov. de 2016

0 votos

Look again at text(). The syntax for text is
text(x, y, strings, ...)
or
text(x, y, z, strings, ...)
so the either the 3rd or 4th argument must be a string or a cell array of strings. Your 4th argument is numeric.
It is not legal in MATLAB to place text at a 5 dimensional coordinate.

Etiquetas

Preguntada:

el 23 de Nov. de 2016

Respondida:

el 23 de Nov. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by