Main Content
Modularize MATLAB Code
For large MATLAB® code, streamline code generation by modularizing the code:
Break up your MATLAB code into smaller, self-contained sections.
Save each section in a MATLAB function.
Generate C/C++ code for each function.
Call the generated C/C++ functions in sequence from a wrapper MATLAB function using
coder.ceval
.Generate C/C++ code for the wrapper function.
Besides streamlining code generation for the original MATLAB code,
this approach also supplies you with C/C++ code for the individual
sections. You can reuse the code for the individual sections later
by integrating them with other generated C/C++ code using coder.ceval
.