Why can’t I generate code for the “resample” function using MATLAB Coder?

I have a MATLAB function that uses the “resample” function that I would like to generate code for using MATLAB Coder, but when I try to generate code, I get the following error:

ERROR: ??? upfirdn requires the DSP System Toolbox.Make sure that it is installed and that a license is available. Error in ==>resamp_func Line: 7 Column: 9 Code generation failed

Why can’t I generate code for “resample” in MATLAB Coder?


Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

The “resample” function from Signal Processing Toolbox uses “upfirdn” under the hood, which requires DSP System Toolbox for code generation. Thus, DSP System Toolbox is required for code generation for the “resample” function.

When ‘resample’ is called inside a MATLAB script, a ‘signal_toolbox’ license is checked out (Signal Processing Toolbox). If code is generated from the resample function, MATLAB also checks out the ‘signal_blocks’ license (DSP Systems Toolbox).

It should also be noted that resample does not accept variable length inputs and that the up/down sample rates (2nd/3rd argument), must be constant values or marked as coder.const if they are variables (they must not change during runtime). For situations where variable-length inputs are required, a workaround is to pre-allocate a temporary vector greater than or equal to the max vector size used during runtime, and then replace the first n elements with the actual signal, then post-process the output to reclaim the variable-size output signal.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.