Error --> Integers can only be combined with in

2019-08-30 08:34发布

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条回答
女痞
2楼-- · 2019-08-30 09:39

put the double just around fuzzySet?

double(fuzzySet).*(abs(membershipMatrix-1) <= tolerance)
查看更多
登录 后发表回答