During HDL code generation, your MATLAB® algorithm must go through the floating-point to fixed-point conversion process, even if it is already a fixed-point algorithm.
To enable MATLAB Function block generation using the HDL Workflow Advisor:
In the HDL Workflow Advisor, on the left, click Code Generation.
In the Advanced tab, select the Generate MATLAB Function Black Box option.
To enable MATLAB Function block generation, at the command line, enter:
hdlcfg = coder.config('hdl'); hdlcfg.GenerateMLFcnBlock = true;
The top-level MATLAB design function cannot have input
or output arguments with the
struct data type.
After you generate HDL code, an untitled model opens containing a MATLAB Function block.
You can use the MATLAB Function block as part of a larger model in Simulink® for simulation and further HDL code generation.
To learn more about generating a MATLAB Function block from a MATLAB algorithm, see System Design with HDL Code Generation from MATLAB and Simulink.