getPreincludeFiles
Syntax
Description
returns names of preinclude files that are described in the build information.files
= getPreincludeFiles(buildinfo
,concatenatePaths
,replaceMatlabroot
,includeGroups
,excludeGroups
)
Examples
Get preinclude Files from Build Information
This example shows how to get preinclude file names from a build information object.
Suppose you have two files, myFile.c
and
myInc.h
, in your current working folder.
// myFile.c #include <stdio.h> int main(void) { #ifdef __STDC_VERSION__ printf("__STDC_VERSION__ is defined\n"); #else printf("__STDC_VERSION__ is not defined\n"); #endif #ifdef MY_MACRO printf("MY_MACRO is defined\n"); #else printf("MY_MACRO is not defined\n"); #endif } // myInc.h #ifndef MYINC_H #define MYINC_H #define MY_MACRO #endif
Create an RTW.BuildInfo
object and specify source files,
undefine directives, and preinclude
files.
buildInfo = RTW.BuildInfo; buildInfo.ComponentName = 'MyComponent'; addSourceFiles(buildInfo, 'myfile.c'); addUndefines(buildInfo, '__STDC_VERSION__'); addPreincludeFiles(buildInfo, 'myinc.h');
Get the preinclude filenames.
preincFiles=getPreincludeFiles(buildInfo,true,false)
preincFiles = 1×1 cell array {'myinc.h'}
Input Arguments
buildinfo
— Build information object
object
Required. RTW.BuildInfo
object that contains information for
compiling and linking generated code.
concatenatePaths
— Concatenate paths and file names
false
| true
Required. Specify whether to concatenate paths and filenames that the function returns:
true
–– Return list of full paths to preinclude files.false
–– Return only filenames of preinclude files.
replaceMatlabroot
— Replace $(MATLAB_ROOT)
and $(START_DIR)
tokens
false
| true
Required. Specify whether to replace the $(MATLAB_ROOT)
and
$(START_DIR)
tokens:
true
–– Replace$(MATLAB_ROOT)
and$(START_DIR)
with the MATLAB® installation folder and the code generation folder respectively.false
–– Do not replace$(MATLAB_ROOT)
and$(START_DIR)
.
includeGroups
— File groups to include
empty (default) | character vector | cell array of character vectors | string scalar
Optional. Specify the file groups that you want to include in the query. To
view the group name of a file group, access the Group
property
of the corresponding object.
excludeGroups
— File groups to exclude
empty (default) | character vector | cell array of character vectors | string scalar
Optional. Specify the file groups that you want to exclude from the query. To
view the group name of a file group, access the Group
property
of the corresponding object.
Output Arguments
files
— preinclude files
cell array of character vectors
Names of preinclude files that the function obtains from the build information.
Version History
Introduced in R2024a
See Also
addUndefines
| getUndefines
| removeUndefines
| addPreincludeFiles
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)