findFiles
Syntax
Description
lists all project files and folders in the project projectFiles = findFiles(proj)proj.
filters the files projectFiles = findFiles(proj,files)files and returns only the files that are
project files.
specifies additional options as one or more name-value arguments. Use this syntax to
find files in a project using their label, to include referenced projects in the
search, and more.projectFiles = findFiles(___,Name=Value)
Examples
Open the Times Table App project. Use currentProject
to create a project object from the currently loaded project.
openExample("matlab/TimesTableProjectExample")
proj = currentProject;List all files that are part of the project.
testFiles = findFiles(proj);
Open the Times Table App project. Use currentProject
to create a project object from the currently loaded project.
openExample("matlab/TimesTableProjectExample")
proj = currentProject;Create an array of the files you want to query.
fileInProject = fullfile("source","timestable.mlapp"); fileOutsideProject = fullfile("..","TimesTableProjectExample.m"); files = [fileInProject;fileOutsideProject]
files =
2×1 string array
"source\timestable.mlapp"
"..\TimesTableProjectExample.m"
Find which files are project files.
projectFiles = findFiles(proj,files)
files =
1×1 string array
"C:\Users\username\Documents\TimesTableProjectExample\TimesTableApp\source\timestable.mlapp"
To query the project file properties such as source control status and
revision ID, create a ProjectFile object instead.
projectFiles = findFiles(proj,files,OutputFormat="ProjectFile") ProjectFile with properties:
Path: "C:\Users\username\Documents\TimesTableProjectExample\TimesTableApp\source\timestable.mlapp"
Revision: "00ef792a696a10b62db2b2951efbab4ecbae6610"
SourceControlStatus: Unmodified
Labels: [1×1 matlab.project.Label]
Open the Times Table App project. Use currentProject
to create a project object from the currently loaded project.
openExample("matlab/TimesTableProjectExample")
proj = currentProject;Create a test suite from all project files labeled
Test.
testFiles = findFiles(proj,Label="Test");If the project has more than one category with the label
Test, specify the category name. For example,
testFiles =
findFiles(proj,Category="Classification",Label="Test");
Open the top-level project in your hierarchy and create a project object.
proj = openProject('C:/projects/TopLevelProject');Find all files labeled Design in your project
hierarchy, including the referenced projects.
allDesignFiles = findFiles(proj,Label="Design",IncludeReferences=true);Input Arguments
Project, specified as a matlab.project.Project object.
Use currentProject to create a project object from the currently
loaded project.
Path of the files to filter, specified as a string array or a cell array of character vectors. When you specify files that include files outside of the project root folder or that are not part of the project, the function returns only the files that are project files.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: findFiles(proj,Label="Test",IncludeReferences=true,OutputFormat="ProjectFile")
Name of the category of labels, specified as a character vector or string scalar.
If you specify only the category name without the label name, the function returns all files that have labels from the specified category.
If you have more than one category in your project with same label names, specify both the category name and the label name.
Data Types: char | string
Name of the label, specified as a character vector or string scalar.
If you specify only the category name without the label name, the function returns all files that have labels from the specified category.
If you have more than one category in your project with same label names, specify both the category name and the label name.
Data Types: char | string
Option to include the referenced projects in the search, specified as
a numeric or logical 1 (true) or 0
(false).
Data Types: logical
Option to choose the format of the output, specified as
"string" or "ProjectFile". Use
the "ProjectFile" format if you require information
about the file such as the source control status and revision ID.
Output Arguments
Project files, returned as a string array or a
ProjectFile object, depending on the value you
specify for OutputFormat.
Version History
Introduced in R2024a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)