Main Content

getSourcePaths

Get source paths from build information

Description

srcpaths = getSourcePaths(buildinfo,replaceMatlabroot,includeGroups,excludeGroups) returns the names of source file paths from the build information. The function returns only the file paths that were added to the build information by using addSourcePaths. The build process uses build information source paths to locate source files that were specified without an explicit path.

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

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

example

Examples

collapse all

Get the source paths from the build information, myBuildInfo.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo,{'/proj/test1' ...
   '/proj/test2' '/drivers/src'}, {'tests' 'tests' ...
   'drivers'});
srcpaths = getSourcePaths(myBuildInfo,false);
>> srcpaths

srcpaths = 

   '\proj\test1'    '\proj\test2'      '\drivers\src'

Get the paths in group tests from the build information, myBuildInfo.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo,{'/proj/test1' ... 
   '/proj/test2' '/drivers/src'}, {'tests' 'tests' ... 
   'drivers'});
srcpaths = getSourcePaths(myBuildInfo,true,'tests');
>> srcpaths

srcpaths = 

     '\proj\test1'    '\proj\test2'

Get a source path from the build information, myBuildInfo. First, get the path without replacing $(MATLAB_ROOT) with an absolute path. Then, get it with replacement. Here, the MATLAB® root folder is \\myserver\myworkspace\matlab.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo, fullfile(matlabroot, ...
   'rtw', 'c', 'src'));
srcpaths = getSourcePaths(myBuildInfo,false);
>> srcpaths{:}

ans =

$(MATLAB_ROOT)\rtw\c\src

>> srcpaths = getSourcePaths(myBuildInfo,true);
>> srcpaths{:}

ans = 

\\myserver\myworkspace\matlab\rtw\c\src

Input Arguments

collapse all

RTW.BuildInfo object that contains information for compiling and linking generated code.

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

Group names of source paths to include in the return from the function, specified as a string or cell array of character vectors. To view the group name of a source path, access the Group property of the corresponding object.

Example: ''

Group names of source paths to exclude from the return from the function, specified as a string or cell array of character vectors. To view the group name of a source path, access the Group property of the corresponding object.

Example: ''

Output Arguments

collapse all

Paths of source files from the build information.

Version History

Introduced in R2006a