Main Content

%#exclude

Ignore a file or function dependency during dependency analysis while executing the mcc command

Description

example

%#exclude fileOrFunction1 [fileOrFunction2 ... fileOrFunctionN] pragma informs the mcc command that the specified file(s) or function(s) need to be excluded from dependency analysis during compilation.

Examples

collapse all

Create a MATLAB® function named testExclusion that includes a %#exclude pragma to determine which files are included and which ones are excluded while executing the mcc command with various options.

function testExclusion()

%#exclude foo.mat
load foo.mat
load bar.mat

%#function foo.txt
fid = fopen('foo.txt');
fclose(fid)

  • Executing mcc -m testExclusion.m results in:

    • bar.mat and foo.txt being included during dependency analysis

    • foo.mat being excluded

  • Executing mcc -m testExclusion.m -X results in:

    • foo.txt being included during dependency analysis

    • bar.mat and foo.mat being excluded

  • Executing mcc -m testExclusion.m -X -a foo.mat results in:

    • foo.mat and foo.txt being included during dependency analysis

    • bar.mat being excluded

    The -a option in the mcc command is used to add files. The %#function pragma is used to inform the mcc command that the specified function(s) should be included in the compilation.

    In the last case, -a option takes precedence over the %#exclude pragma.

See Also

Introduced in R2020a