currentProject
获取当前工程
说明
获取当前打开的工程,并返回工程对象 proj
= currentProjectproj
,您可以使用该对象以编程方式操作工程。在当前打开的工程正在为引用工程运行快捷方式、启动文件或关闭文件时,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: ""
输出参数
proj
— 工程
matlab.project.Project
对象
工程,以 matlab.project.Project
对象形式返回。使用 matlab.project.Project
以编程方式操作当前打开的工程。
版本历史记录
在 R2019a 中推出
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)