Why does KMEANS give an error when using integer data types?

7 次查看(过去 30 天)
When I attempt to cluster my integer data using KMEANS, I receive the following error
??? Error using ==> minus
Integers can only be combined with integers of the same class, or scalar doubles.

采纳的回答

MathWorks Support Team
This error is the expected behavior for passing an integer data type to the KMEANS function. KMEANS and many other statistical functions are not designed to work with integer data in MATLAB 7.2 (R2006a).
The only workaround is to convert the integer data to a double data type before passing it to KMEANS. For more information, refer the following documentation page on the DOUBLE function:
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/double.html>

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by