このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
findFile
名前によるプロジェクト ファイルの検索
説明
は指定した名前の指定したプロジェクトでファイルを取得します。ラベルをクエリしたり、関数 file
= findFile(proj
,fileOrFolder
)addLabel
または関数 removeLabel
を使用したりする前に、ファイルを取得する必要があります。
例
名前によるファイルの検索
プロジェクト Times Table App を開きます。currentProject
を使用して、現在読み込まれているプロジェクトからプロジェクト オブジェクトを作成します。
openExample("matlab/TimesTableProjectExample")
proj = currentProject;
findFile
を使用して、名前を指定してファイルを取得します。ファイルがプロジェクトのルートのサブフォルダーにある場合、絶対パスを指定する必要があります。
myfile = findFile(proj,"source/timesTableGame.m")
myfile = ProjectFile with properties: Path: "C:\myProjects\examples\TimesTableApp\source\timesTableGame.m" Labels: [1×1 matlab.project.Label] Revision: "734fbb2f815848e22694d9ac7ea28953d5e42635" SourceControlStatus: Unmodified
あるいは、インデックスを指定してファイルを取得することもできます。1 番目のファイルを取得します。
file = proj.Files(1);
ファイルで何ができるか調べます。
methods(file)
Methods for class matlab.project.ProjectFile: addLabel findLabel removeLabel
入力引数
proj
— プロジェクト
matlab.project.Project
オブジェクト
プロジェクト。matlab.project.Project
オブジェクトとして指定します。currentProject
を使用して、現在読み込まれているプロジェクトからプロジェクト オブジェクトを作成します。
fileOrFolder
— ファイルのパスまたはフォルダーのパス
文字ベクトル | string スカラー
プロジェクトのルート フォルダーを基準とした、検索するファイルまたはフォルダーのパス。文字ベクトルまたは string スカラーとして指定します。指定した値には、プロジェクト ルートからファイルへの絶対パスが、その途中のすべてのサブフォルダーの名前と共に含まれていなければなりません。ファイル拡張子も含まれていなければなりません。ファイルまたはフォルダーはルート フォルダー内になければなりません。
出力引数
file
— プロジェクト ファイル
ProjectFile
オブジェクト
プロジェクト ファイル。クエリまたは変更可能な ProjectFile
オブジェクトとして返されます。
バージョン履歴
R2019a で導入
参考
currentProject
| openProject
| addLabel
| removeLabel
| findCategory
| findLabel
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)