Main Content

currentProject

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

説明

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

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

すべて折りたたむ

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

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

  Project with properties:

                        Name: "Times Table App"
    SourceControlIntegration: "Git"
          RepositoryLocation: "C:\workSpace\examples\repositories\TimesTableApp"
       SourceControlMessages: [1×3 string]
                    ReadOnly: 0
                    TopLevel: 1
                Dependencies: [1×1 digraph]
                  Categories: [1×1 matlab.project.Category]
                       Files: [1×15 matlab.project.ProjectFile]
                   Shortcuts: [1×4 matlab.project.Shortcut]
                 ProjectPath: [1×3 matlab.project.PathFolder]
           ProjectReferences: [1×0 matlab.project.ProjectReference]
                StartupFiles: [1×0 string]
               ShutdownFiles: [1×0 string]
         DefinitionFilesType: FixedPathMultiFile
                 Description: "This example project contains the source code and tests for a simple educational app. ↵↵Use the "Project Shortcuts" toolstrip tab to find ways of getting started with this project."
                  RootFolder: "C:\workSpace\examples\TimesTableApp"
       SimulinkCodeGenFolder: ""
        ProjectStartupFolder: "C:\workSpace\examples\TimesTableApp"
         SimulinkCacheFolder: ""

出力引数

すべて折りたたむ

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

バージョン履歴

R2019a で導入