Error --> Integers can only be combined with integers of the same class, or scalar doubles

馋奶兔 提交于 2019-12-12 03:09:26

问题


I have the following two matrices:

fuzzySet

255  7  7
255  7  7
255  7  7

membershipMatrix

2.881749158360024e-04   0.999999819474077   0.904200609951489
0.0336048930092375      0.517034652401936   0.847219463816453
2.881749158360024e-04   0.999999819474077   0.904200609951489

When I tried running this code portion:

tolerance = 0.01; 
core = double(fuzzySet.*(abs(membershipMatrix-1) <= tolerance)) + membershipMatrix.*(membershipMatrix.*(abs(membershipMatrix-1) > tolerance););

I got the following error:

??? Error using ==> times
Integers can only be combined with integers of the same class, or scalar doubles.

Error in ==> fs at 36
core = fuzzySet.*(abs(membershipMatrix-1) <= tolerance) +
membershipMatrix.*(membershipMatrix > tolerance);

How can I work around this error?

Thanks.


回答1:


put the double just around fuzzySet?

double(fuzzySet).*(abs(membershipMatrix-1) <= tolerance)


来源:https://stackoverflow.com/questions/15591263/error-integers-can-only-be-combined-with-integers-of-the-same-class-or-scal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!