| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
addTMFTokens(buildinfo, tokennames, tokenvalues, groups)
groups is optional.
Build information returned by RTW.BuildInfo.
A character array or cell array of character arrays that specifies names of TMF tokens (for example, '|>CUSTOM_OUTNAME<|') to be added to the build information. The function adds the token names to the end of a vector in the order that you specify them.
If you specify a token name that already exists in the vector, the first instance takes precedence and its value used for replacement.
A character array or cell array of character arrays that specifies TMF token values corresponding to the previously-specified TMF token names. The function adds the token values to the end of a vector in the order that you specify them.
A character array or cell array of character arrays that groups specified TMF tokens. You can use groups to
Document the use of specific TMF tokens
Retrieve or apply groups of TMF tokens
You can apply
A single group name to a TMF token
A single group name to multiple TMF tokens
Multiple group names to collections of multiple TMF tokens
| To... | Specify groups as a... |
|---|---|
| Apply one group name to all TMF tokens | Character array. |
| Apply different group names to TMF tokens | Cell array of character arrays such that the number of group names that you specify matches the number of elements you specify for tokennames. |
Call the addTMFTokens function inside a post code generation command to provide build-time information to help customize makefile generation. The tokens specified in the addTMFTokens function call must be handled appropriately in the template makefile (TMF) for the target selected for your model. For example, if your post code generation command calls addTMFTokens to add a TMF token named |>CUSTOM_OUTNAME<| that specifies an output file name for the build, the TMF must take appropriate action with the value of |>CUSTOM_OUTNAME<| to achieve the desired result. (See Example.)
The addTMFTokens function adds specified TMF token names and values to the model's build information. The Real-Time Workshop software stores the TMF tokens in a vector. The function adds the tokens to the end of the vector in the order that you specify them.
In addition to the required buildinfo, tokennames, and tokenvalues arguments, you can specify an optional groups argument. You can specify groups as a character array or a cell array of character arrays.
| If You Specify an Optional Argument as a... | The Function... |
|---|---|
| Character array | Applies the character array to all TMF tokens it adds to the build information. |
| Cell array of character arrays | Pairs each character array with a specified TMF token. Thus, the length of the cell array must match the length of the cell array you specify for tokennames. |
Inside a post code generation command, add the TMF token |>CUSTOM_OUTNAME<| and its value to build information myModelBuildInfo, and place the token in the group LINK_INFO.
myModelBuildInfo = RTW.BuildInfo;
addTMFTokens(myModelBuildInfo, ...
'|>CUSTOM_OUTNAME<|', 'foo.exe', 'LINK_INFO');In the TMF for the target selected for your model, code such as the following uses the token value to achieve the desired result:
CUSTOM_OUTNAME = |>CUSTOM_OUTNAME<| ... target: $(LD) -o $(CUSTOM_OUTNAME) ...
Programming a Post Code Generation Command
![]() | addSourcePaths | emlc | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |