Generate MATLAB files for code generation using coder configurer
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
, and
initialize.m
— predict.m
and
update.m
are the entry-point functions for the
predict
and update
functions of the
machine learning model, respectively, and these two functions call
initialize.m
. You can modify these files according to your code
generation workflow. For example, you can modify the predict.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 the saveLearnerForCoder
function to save machine learning model information
in a MAT-file whose file name is stored in the OutputFileName
property of a coder configurer. initialize.m
loads the saved
MAT-file by using the loadLearnerForCoder
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
.
To customize the code generation workflow, use generateFiles
and
codegen
(MATLAB Coder). If you do not need to customize
your workflow, use generateCode
.
In addition to generating the four MATLAB files generated by generateFiles
, the
generateCode
function also generates the C/C++ code.
generateCode
| learnerCoderConfigurer
| update
| validatedUpdateInputs