Main Content

listImpactedFiles

Get files impacted by changes to specified project files

Since R2021a

Description

impactedfiles = listImpactedFiles(proj,files) returns the names of the project files that require the specified files to run.

example

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object.

openExample("matlab/TimesTableProjectExample")
proj = currentProject;

Make a change to timesTableGame.m.

fid = fopen('source/timesTableGame.m','a');
fwrite(fid,'% Add simple comment');
fclose(fid)

Get the files impacted by the modified files.

modifiedfiles = listModifiedFiles(proj);
impactedfiles = listImpactedFiles(proj,modifiedfiles)
impactedfiles = 

  6×1 string array

    "C:\workSpace\examples\TimesTableApp\requirements\TimesTableRequirements.mlx"
    "C:\workSpace\examples\TimesTableApp\source\timesTableGame.m"
    "C:\workSpace\examples\TimesTableApp\source\timestable.mlapp"
    "C:\workSpace\examples\TimesTableApp\tests\tAnswerIsCorrect.m"
    "C:\workSpace\examples\TimesTableApp\tests\tCurrentQuestion.m"
    "C:\workSpace\examples\TimesTableApp\tests\tNewTimesTable.m"

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Path of project files including file extensions, specified as a cell array of character vectors, a string array, or a ProjectFile object array. Specify files as absolute file paths or paths relative to the project root folder. The files must be within the project root folder.

Output Arguments

collapse all

Impacted project files, returned as a string array.

Version History

Introduced in R2021a