matlab how to generate pitch.m C/C++ code with coder

one of module call pitch.m as follow
f0 = pitch(sig1, fs, 'WindowLength', round(fs .* 0.05), 'OverlapLength', round(fs * (0.05 - 0.025)));
but coder failed to generate C/C++ code. error message as follow:
Failed to compute constant value for nontunable property 'WindowLength'. In code generation, nontunable properties can only be assigned constant values.

 采纳的回答

You will need to have a switch statement on every fs that you wish to permit, each time calling with a hard-coded WindowLength. So for example you might have a branch for 8000, another for 11025, another for 12000, another for 22050, another for 24000, another for 44100, another for 48000, and so on.

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息

产品

版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by