Main Content

Resolve Error:fi*non-fi

Issue

When multiplying a fixed-point variable by a non-fixed-point variable, the variable that does not have a fixed-point type can only be a constant

Possible Solutions

Before instrumenting your code, cast the non-fivariable to an acceptable fixed-point type.

原始算法 New Algorithm
functiony = myProduct(x) y = 1;forn = 1:length(x) y(:) = y*x(n);endend
functiony = myProduct(x) y = ones(1,1,'like', x(1)*x(1));forn = 1:length(x) y(:) = y*x(n);endend

See Also

Functions