| 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 |
[macrodefs, identifiers, values] = getDefines(buildinfo, includeGroups, excludeGroups)
includeGroups and excludeGroups are optional.
Build information returned by RTW.BuildInfo.
A character array or cell array of character arrays that specifies groups of macro definitions you want the function to return.
A character array or cell array of character arrays that specifies groups of macro definitions you do not want the function to return.
Preprocessor macro definitions stored in the model's build information. The function returns the macro definitions in three vectors.
| Vector | Description |
|---|---|
| macrodefs | Complete macro definitions with -D prefix |
| identifiers | Names of the macros |
| values | Values assigned to the macros (anything specified to the right of the first equals sign) ; the default is an empty string ('') |
The getDefines function returns preprocessor macro definitions stored in the model's build information. When the function returns a definition, it automatically
Prepends a -D to the definition if the -D was not specified when the definition was added to the build information
Changes a lowercase -d to -D
Using optional includeGroups and excludeGroups arguments, you can selectively include or exclude groups of definitions the function is to return.
If you choose to specify excludeGroups and omit includeGroups, specify a null string ('') for includeGroups.
Get all preprocessor macro definitions stored in build information myModelBuildInfo.
myModelBuildInfo = RTW.BuildInfo;
addDefines(myModelBuildInfo, {'PROTO=first' '-DDEBUG'...
'test' '-dPRODUCTION'}, {'Debug' 'Debug' 'Debug'...
'Release'});
[defs names values]=getDefines(myModelBuildInfo);
defs
defs =
'-DPROTO=first' '-DDEBUG' '-Dtest' '-DPRODUCTION'
names
names =
'PROTO'
'DEBUG'
'test'
'PRODUCTION'
values
values =
'first'
''
''
''Get the preprocessor macro definitions stored with the group name Debug in build information myModelBuildInfo.
myModelBuildInfo = RTW.BuildInfo;
addDefines(myModelBuildInfo, {'PROTO=first' '-DDEBUG'...
'test' '-dPRODUCTION'}, {'Debug' 'Debug' 'Debug'...
'Release'});
[defs names values]=getDefines(myModelBuildInfo, 'Debug');
defs
defs =
'-DPROTO=first' '-DDEBUG' '-Dtest'
Get all preprocessor macro definitions stored in build information myModelBuildInfo, except those with the group name Debug.
myModelBuildInfo = RTW.BuildInfo;
addDefines(myModelBuildInfo, {'PROTO=first' '-DDEBUG'...
'test' '-dPRODUCTION'}, {'Debug' 'Debug' 'Debug'...
'Release'});
[defs names values]=getDefines(myModelBuildInfo, '', 'Debug');
defs
defs =
'-DPRODUCTION'getCompileFlags, getLinkFlags
Programming a Post Code Generation Command
![]() | getCompileFlags | getFullFileList | ![]() |

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 |