Main Content

coder.MATLABCodeTemplate class

Package: coder
Superclasses:

Represent code generation template for MATLAB Coder

Description

Create a coder.MATLABCodeTemplate object from a code generation template (CGT) file. You can use this file to customize the code generation output for MATLAB® Coder™. If a CGT file is not provided, the coder.MATLABCodeTemplate object is created from the default template file matlabroot/toolbox/coder/matlabcoder/templates/matlabcoder_default_template.cgt.

Construction

newObj = coder.MATLABCodeTemplate() creates a coder.MATLABCodeTemplate object from the default code generation template (CGT) file matlabroot/toolbox/coder/matlabcoder/templates/matlabcoder_default_template.cgt.

newObj = coder.MATLABCodeTemplate(CGTFile) creates a coder.MATLABCodeTemplate object from the code generation template file CGTFile. If the file is not on the MATLAB path, specify a full path to the file.

Input Arguments

CGTFile

Name of code generation template file

Methods

emitSectionEmit comments for template section
getCurrentTokensGet current tokens
getTokenValueGet value of token
setTokenValueSet value of token for code generation template

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects.

Examples

newObj = coder.MATLABCodeTemplate()
newObj = 

  MATLABCodeTemplate with properties:

    CGTFile: 'matlabcoder_default_template.cgt'
newObj = coder.MATLABCodeTemplate('custom_matlabcoder_template.cgt')
newObj = 

  MATLABCodeTemplate with properties:

    CGTFile: 'custom_matlabcoder_template.cgt'