Main Content

listImpactedFiles

获取受指定工程文件更改影响的文件

自 R2021a 起

说明

示例

impactedfiles = listImpactedFiles(proj,files) 返回需要指定的 files 才能运行的工程文件的名称。

示例

全部折叠

打开 Times Table App 工程。使用 currentProject 创建一个工程对象。

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

timesTableGame.m 进行更改。

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

获取受修改文件影响的文件。

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"

输入参数

全部折叠

工程,指定为 matlab.project.Project 对象。使用 currentProject 从当前加载的工程创建一个工程对象。

工程文件的路径,包括文件扩展名,指定为字符向量元胞数组、字符串数组或 ProjectFile 对象数组。将 files 指定为绝对文件路径或相对于工程根文件夹的路径。文件必须在工程根文件夹中。

输出参量

全部折叠

受影响的工程文件,以字符串数组形式返回。

版本历史记录

在 R2021a 中推出