generateFiles
Generate MATLAB files for code generation using coder configurer
Description
generateFiles(
generates the
MATLAB® files required to generate C/C++ code by using the coder configurer
configurer
)configurer
, and saves the generated files in the current
folder.
To customize the code generation workflow, use generateFiles
and
codegen
(MATLAB Coder). If you do not need to customize your
workflow, use generateCode
.
generateFiles
generates the following MATLAB files:
predict.m
,update.m
, andinitialize.m
—predict.m
andupdate.m
are the entry-point functions for thepredict
andupdate
functions of the machine learning model, respectively, and these two functions callinitialize.m
. You can modify these files according to your code generation workflow. For example, you can modify thepredict.m
file to include data preprocessing, or you can add these entry-point functions to another code generation project.A MAT-file that includes machine learning model information —
generateFiles
uses thesaveLearnerForCoder
function to save machine learning model information in a MAT-file whose file name is stored in theOutputFileName
property of a coder configurer.initialize.m
loads the saved MAT-file by using theloadLearnerForCoder
function.
After you generate these files, generate C/C++ code by using codegen
(MATLAB Coder) and the prepared codegen
argument stored in the
CodeGenerationArguments
property of a coder configurer.
If the folder already includes all four MATLAB files, then generateFiles
does not generate any
files.
generateFiles(
generates the MATLAB files in the folder specified by configurer
,'OutputPath',outputPath
)outputPath
.
Examples
Input Arguments
Alternative Functionality
To customize the code generation workflow, use
generateFiles
andcodegen
(MATLAB Coder). If you do not need to customize your workflow, usegenerateCode
. In addition to generating the four MATLAB files generated bygenerateFiles
, thegenerateCode
function also generates the C/C++ code.
Version History
Introduced in R2018b