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-fi variable to an acceptable fixed-point type.

Original AlgorithmNew Algorithm
function y = myProduct(x)
    y = 1;
    for n = 1:length(x)
        y(:) = y*x(n);
    end
end
function y = myProduct(x)
    y = ones(1,1, 'like', x(1)*x(1));
    for n = 1:length(x)
        y(:) = y*x(n);
    end
end

See Also

Functions