Enable MATLAB Function Block Generation
Requirements for MATLAB Function Block Generation
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.
Enable MATLAB Function Block Generation
Using the GUI
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.
Using the Command Line
To enable MATLAB Function block generation, at the command line, enter:
hdlcfg = coder.config('hdl'); hdlcfg.GenerateMLFcnBlock = true;
Restrictions for MATLAB Function Block Generation
The top-level MATLAB design function cannot have input
or output arguments with the struct
data type.
Results of MATLAB Function Block Generation
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.