function kmeans is not able to process uint8 what should i do?
5 ビュー (過去 30 日間)
古いコメントを表示
I am using kmeans function and getting following error
??? Error using ==> plus Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> kmeans>distfun at 704 D(:,i) = D(:,i) + (X(:,j) - C(i,j)).^2;
Error in ==> kmeans at 313 D = distfun(X, C, distance, 0);
What should i do know
0 件のコメント
回答 (1 件)
David Young
2015 年 3 月 2 日
Convert your date to double before passing it to kmeans. For example, if Xi is your uint8 data array,
Xd = double(Xi);
idx = kmeans(Xd, k);
If you have very large arrays and so run out of memory, consider using single instead of double.
2 件のコメント
David Young
2015 年 3 月 2 日
Sorry, there isn't enough information to solve this new problem. I suggest you post a new question, showing the code that calls kmeans.
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!