Main Content

coder.MATLABCodeTemplate.setTokenValue

Class: coder.MATLABCodeTemplate
Namespace: coder

Set value of token for code generation template

Syntax

setTokenValue(tokenName,tokenValue)

Description

setTokenValue(tokenName,tokenValue) sets the value of a token for a code generation template.

Input Arguments

tokenName

The name of the token

tokenValue

The value of the token

Default: empty

Examples

Create a MATLABCodeTemplate object from a custom template. Set the value for a custom token in the template.

newObj = coder.MATLABCodeTemplate('myCGTFile');
% Create a MATLABCodeTemplate object from a custom template file
newObj.setTokenValue('myCustomToken', 'myValue');
% Set the value of a custom token in the file
newObj.getTokenValue('myCustomToken')
% Check value of the custom token