メインコンテンツ

currentProject

R2026b

現在のプロジェクトを取得

説明

proj = currentProject は現在開いているプロジェクトを取得し、プロジェクト オブジェクト proj を返します。これを使用して、プロジェクトをプログラムで操作することができます。現在開いているプロジェクトが参照プロジェクトのショートカット、起動ファイル、またはシャットダウン ファイルを実行している場合、currentProject は代わりに参照プロジェクトのオブジェクトを返します。プロジェクトが開いていない場合、MATLAB® はエラーを表示します。プロジェクトが読み込まれているかどうかをプログラムでチェックするには、代わりに matlab.project.rootProject を使用します。プロジェクトが読み込まれているかどうかをチェックを参照してください。

プログラムによるプロジェクトの操作の詳細については、プロジェクトのプログラムによる作成と編集を参照してください。

例

例

すべて折りたたむ

Times Table App のプロジェクトを開き、プロジェクト オブジェクトを取得します。これは、コマンド ラインでのプロジェクトの操作に使用できます。

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

  Project with properties:

   Details
                             Name: "Times Table App"
                          Summary: "This example project contains the source code and tests for a simple educational app. Use the project shortcuts to get started with this project."
                       RootFolder: "C:\WorkSpace\TimesTableProjectExample\TimesTableApp"
              DefinitionFilesType: FixedPathMultiFile
                         TopLevel: 1
         SourceControlIntegration: "Git"
               RepositoryLocation: "C:\WorkSpace\repositories\TimesTableProjectExample"

   Files
                            Files: [1×13 matlab.project.ProjectFile]
                        Shortcuts: [1×4 matlab.project.Shortcut]
                       Categories: [1×1 matlab.project.Category]
                     Dependencies: [1×1 digraph]
              DependencyCacheFile: ""

   Environment
             ProjectStartupFolder: "C:\WorkSpace\TimesTableProjectExample\TimesTableApp"
                     StartupFiles: [1×0 string]
                    ShutdownFiles: [1×0 string]
                      PathFolders: [2×1 string]
                      TestFolders: [0×1 string]
              ProjectDependencies: [1×0 matlab.project.Dependency]
                ProjectReferences: [1×0 matlab.project.ProjectReference]

   Simulink
                    StartSimulink: 0
    RefreshSimulinkCustomizations: 0
              SimulinkCacheFolder: ""
            SimulinkCodeGenFolder: ""

出力引数

すべて折りたたむ

プロジェクト。matlab.project.Project オブジェクトとして返されます。matlab.project.Project を使用して、現在開いているプロジェクトをプログラムで操作します。

バージョン履歴

R2019a で導入