主要内容

Using a Project

此示例显示了如何使用现有项目来管理设计中的文件。它显示了如何自动化启动和关闭任务,为常见任务添加快捷方式,运行支票,升级项目文件,分析项目依赖项并共享您的项目。

As a design grows, managing referenced files and dependencies becomes more complicated. Projects help you organize large hierarchies by finding required files, managing and sharing files and settings, and interacting with source control.

This project example is not under source control. As a result, essential tools needed in a collaborative environment are not available for use, for example, comparing files to their ancestors, comparing revisions and resolving conflicts.

Set up the Example Files and Open the Project

创建并打开项目示例文件的工作副本。Matlab®将文件复制到示例文件夹,以便您可以编辑它们。

sldemo_slproject_airframe_setup;
使用“ mingw64编译器(C)”建造。MEX成功完成。

管理项目路径

When you open your project, MATLAB adds the project path to the MATLAB search path before applying startup shortcuts.

When you close your project, MATLAB removes the project path from the MATLAB search path after applying shutdown shortcuts.

1.要在项目路径上添加或删除文件夹Project标签,在环境section, click项目路径:

  • 要将文件夹(无子文件夹)添加到项目路径中,请单击Add Folder。如果要添加文件夹及其子文件夹,请单击Add with Subfoldersinstead. Then use the Open dialog box to add the new folder.

  • 删除一个符合der from the project path, from the display list, select the folder. Then click消除

重要的是要将项目文件添加到project path to ensure the Dependency Analyzer detects all project files.

指定项目详细信息,启动文件夹和派生文件文件夹

2. On theProject标签,在环境section, clickDetails。Use the Project Details dialog box to:

  • Edit the project name or add a description.

  • 查看Project root文件夹。您可以通过在文件系统上移动整个项目,并将项目重新开放在其新位置中来更改项目的根源。所有项目文件路径均存储为相对路径。

  • 查看或编辑启动文件夹。By default, this is set to the project root. When you open the project, the current working folder changes to the project root folder. You can specify a different startup folder or click清除

  • 查看或编辑仿真缓存文件夹and代码生成文件夹

要更改MATLAB上的新项目的默认项目rootHome标签,在环境section, clickPreferences选择MATLAB> Project并指定Default folder

自动启动和关闭任务

您可以设置项目文件,例如MATLAB脚本和Simulink®模型,以在项目打开或关闭时运行,打开或关闭。金宝app

3.要配置现有文件以在项目启动和关闭上运行,或指定环境选项,请单击Startup Shutdownbutton in theProjecttab. In the Manage Project Startup and Shutdown dialog box

  • 添加或删除启动和关闭文件。如果执行顺序很重要,请使用箭头按钮更改订单。

  • Use the check boxes to specify environment options. SelectStart Simulink before this project starts打开项目时开始Si金宝appmulink。选择刷新模拟自定义金宝app跑步sl_customizationfiles on project startup and shutdown.

项目快捷方式的常见任务

Create project shortcuts for common tasks to make it easy to find and access important files and operations. For example, find and open top models, run code, and simulate models.

4.On theProject Shortcutstab, this example project has shortcuts for the top-level model, a utility function to rebuild s-functions, and a design description document.

  • 点击shortcutF14型号to open the root model for this project.

  • 点击shortcut重建项目的S函数生成s功能。

  • 点击新快捷方式按钮为项目文件创建新的快捷方式。

  • Right-click a shortcut and selectEdit Shortcutto edit a shortcut.

探索文件视图

6.在Files查看,选择Project (文件数)view to manage the files within your project. This view only shows files that are part of your project.

7.使用全部查看以查看工作副本中的所有文件。这显示了项目root下的所有文件,而不仅仅是项目中的文件。此视图对于从工作副本中添加文件很有用。

8. In anyFilesview, at the top right, change the layout fromtoList将文件视为列表。单击“组织视图”按钮to customize the views and to sort files.

Analyze Project Dependencies

9. Use the Dependency Analyzer to investigate dependencies visually and explore the structure of your project. On theProject选项卡,单击向下箭头以展开工具画廊。在下面Apps, 点击Dependency Analyzer

The Dependency Analyzer summarizes the results in the pane on the right. It lists the names of the used下载188bet金宝搏and附加组件。它检测出问题,例如丢失文件,项目中的文件,未保存的更改和过时的派生文件。在此示例中,分析仪标识“不在项目中的文件”,并用警告标志标记它

10.To highlight problem files, in theProblemssection, point to the problem message and click the magnifying glass. In this example, thetimesthree.mexw64fileis required by the project but is not part of it. Right-clicktimesthree.mexw64and select添加到项目orHide Warnings。The next time you run the dependency analysis, the analyzer will not mark this file as a problem.

11. Perform an impact analysis on a selected file.

影响分析向您展示了更改在进行更改之前如何影响其他文件。例如,查找所需的文件timesthree.mexw64要正确运行,右键单击timesthree.mexw64and select查找所需。找到如何变化timesthree.mexw64影响文件,右键点击timesthree.mexw64and selectFind Impacted

运行检查并升级项目文件

12. Upgrade all models, libraries, and MATLAB code files in your project to the latest release using a simple workflow. On theProject选项卡,单击向下箭头以展开工具画廊。在下面项目检查, 点击升级项目

To upgrade all files, run all checks, and apply fixes automatically where possible, clickUpgrade。If you want to change the settings, use these options before clickingUpgrade:

  • If you want to run upgrade checks but not apply fixes automatically where possible, clear the check boxApply upgrades automatically

  • 如果要更改要升级的文件并运行哪些文件,请单击Change Options。In the Upgrade Options dialog box, clear check boxes for models and checks you want to exclude from the upgrade.

The Upgrade Project tool apply all fixes automatically when possible, upgrade all model hierarchies in the project at once, and produce a report.

分享Project

Before sharing projects with other users, it is helpful to find required files and products using the Dependency Analyzer.

13.On theProject选项卡,选择分享and explore the different sharing options.

You can share your project as an archive and send it by email. On theProject选项卡,选择分享>Archive。You can export the whole project or just a part of it using导出资料。如果您决定将文件排除在项目之外,请使用“依赖项分析仪”检查将文件排除对项目的影响。如果您已引用项目并想导出引用的项目文件,请选择Include referenced projectscheck box.

You can also share your project and make it publicly available on GitHub®. This adds Git source control to the open project.

See Also

Perform Impact Analysis with a Project

通过项目运行自定义任务

更多信息

Project Management