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

7 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 28 Juin 2010
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.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 28 Juin 2010
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>

Plus de réponses (0)

Produits


Version

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by