Main Content

getIncludeFiles

Get include files from model build information

Description

example

files = getIncludeFiles(buildinfo,concatenatePaths,replaceMatlabroot,includeGroups,excludeGroups) returns the names of include files from the build information.

The function requires the buildinfo, concatenatePaths, and replaceMatlabroot arguments. You can use optional includeGroups and excludeGroups arguments. These optional arguments let you include or exclude groups selectively from the include files returned by the function.

If you choose to specify excludeGroups and omit includeGroups, specify a null character vector ('') for includeGroups.

The makefile for the model build resolves file locations based on source paths and rules. The build process does not require you to resolve the path of every file in the build information. If you specify true for the concatenatePaths argument, the getIncludeFiles function returns the path for each file:

  • If a path was explicitly associated with the file when it was added.

  • If you called updateFilePathsAndExtensions to resolve file paths and extensions before calling getIncludeFiles.

Examples

collapse all

Get the include paths and file names from the build information, myModelBuildInfo.

myModelBuildInfo = RTW.BuildInfo;
addIncludeFiles(myModelBuildInfo,{'etc.h' 'etc_private.h' ...
   'mytypes.h'},{'/etc/proj/etclib' '/etcproj/etc/etc_build' ...
   '/common/lib'},{'etc' 'etc' 'shared'});
incfiles=getIncludeFiles(myModelBuildInfo,true,false);
>> incfiles

incfiles = 

    [1x22 char]    [1x36 char]    [1x21 char]

Get the names of include files in group etc from the build information, myModelBuildInfo.

myModelBuildInfo = RTW.BuildInfo;
addIncludeFiles(myModelBuildInfo,{'etc.h' 'etc_private.h' ...
   'mytypes.h'},{'/etc/proj/etclib' '/etcproj/etc/etc_build' ...
   '/common/lib'},{'etc' 'etc' 'shared'});
incfiles = getIncludeFiles(myModelBuildInfo,false,false, ... 
   'etc');
>> incfiles

incfiles = 

    'etc.h'     'etc_private.h'

Input Arguments

collapse all

SpecifyFunction Action
trueConcatenates and returns each file name with its corresponding path.
falseReturns only file names.

Example: true

Use the replaceMatlabroot argument to control whether the function includes the MATLAB® root definition in the output it returns.

SpecifyFunction Action
trueReplaces the token $(MATLAB_ROOT) with the absolute path for your MATLAB installation folder.
falseDoes not replace the token $(MATLAB_ROOT).

Example: true

To use the includeGroups argument, view available groups by using myGroups = getGroups(buildInfo).

Example: ''

To use the excludeGroups argument, view available groups by using myGroups = getGroups(buildInfo).

Example: ''

Output Arguments

collapse all

The names of include files that you add with the addIncludeFiles function. If you call the packNGo function, the names include files that packNGo found and added while packaging model code.

Introduced in R2006a