MATLAB System block error: The input to coder.const cannot be reduced to a constant

5 次查看(过去 30 天)
I'm trying to build a system block with a dynamic number of inputs. I'm able to choose the number of inputs through a dialog and it updates the number of inputs, but when I simulate the model I get: "The input to coder.const cannot be reduced to a constant".
I'm using the following code:
function num = getNumInputsImpl(obj)
% Define total number of inputs for system with optional
num = obj.NumInputs;
end
I can't simply change it to interpreted execution, because I'm planning to use that system block to generate C code. Any thoughts?

采纳的回答

Guilherme T Silva
Guilherme T Silva 2016-10-15
Solved the problem defining the property NumInputs as nontunable.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by