Main Content

Explore Project Tools with the Airframe Project

Explore the Airframe Project

Try an example project to see how the tools can help you organize your work. Projects can help you manage:

  • Your design (model and library files,.m,.mat, and other files, source code for S-functions, and data)

  • A set of actions to use with your project (run setup code, open models, simulate, build, and run shutdown code)

  • Working with files under source control (check out, compare revisions, tag or label, and check in)

The Airframe example shows how to:

  1. Set up and browse some example project files under source control.

  2. 检查项目快捷键访问频繁使用d files and tasks.

  3. Analyze dependencies in the example project and locate required files that are not yet in the project.

  4. Modify some project files, find and review modified files, compare to an ancestor version, and commit modified files to source control.

  5. Explore views of project files only, modified files, and all files under the project root folder.

Set Up Project Files and Open the Project

Run this command to create a working copy of the project files and open the project:

sldemo_slproject_airframe

The project example copies files to your temporary folder so that you can edit them and put them under Git™ source control.

The Project window opens and loads the project. The project is configured to run some startup tasks, including changing the current working folder to the project root folder.

Note

Alternatively, you can try this example project using SVN source control, by specifyingsldemo_slproject_airframe_svn. The following example shows the options when using Git.

View, Search, and Sort Project Files

  1. In a Project, examine theFilesview to manage the files within your project. When theProject (number of files)view is selected, only the files in your project are shown.

  2. To see all the files in your sandbox, clickAll. This view shows all the files that are under the project root, not just the files that are in the project. This view is useful for adding files to the project from your sandbox.

  3. To find particular files or file types, in any file view, type in the search box or click the Filter button. You can also search inside files.

    Click thexto clear the search.

  4. To view files as a list instead of a tree, use the Layout control.

  5. To sort files and to customize the columns, click the Organize view button at the far right of the search box.

  6. You can dock and undock the Project into the MATLAB®Desktop. If you want to maximize space for viewing your project files, undock the Project. Drag the title bar to undock it.

Open and Run Frequently Used Files

您可以使用快捷键使脚本更容易find in a large project. View and run shortcuts on the Project Shortcuts toolstrip. You can organize the shortcuts into groups.

In this example, the script that regenerates S-functions is set as a shortcut so that a new user of the project can easily find it. You can also make the top-level model, or models, within a project easier to find. In this example, the top-level model,slproject_f14.mdl, is a shortcut.

Regenerate the S-functions.

  1. On the Project Shortcuts tab in the toolstrip, click the shortcutRebuild Project's S-functions.

    The shortcut file builds a MEX-file. If you do not have a compiler set up, follow the instructions to choose a compiler.

  2. Open therebuild_s_functions.mfile to explore how it works.

Open the top model.

  • On the Project Shortcuts tab, click the shortcutF14 Modelto open the root model for this project.

  • To create shortcuts to access frequently used files, select theFilesview, right-click a file, and selectCreate Shortcut.

You can also specify files to run at startup and shutdown. SeeAutomate Startup Tasks.

Review Changes in Modified Files

Open and make changes to files and review changes.

  1. Select the Files view. View folders using the tree layout, and then expand theutilitiesfolder.

  2. Either double-click to open thefind_top_modelsfile for editing from the project, or right-click and selectOpen.

  3. Make a change in the Editor, such as adding a comment, and save the file.

  4. In the project Files view, select the tabModified (number of files). After editing the file, you seeModified (2). The files you changed appear in the list. You edited a file in the utilities folder. Observe that the Modified files list also includes aresourcesfolder. The files stored in theresourcesfolder are internal project definition files generated by your changes. The project definition files allow you to add metadata to files, for example, by creating shortcuts, adding labels, and adding a project description. Project definition files also define the files that are added to your project. You can review changes in revisions of project definition files like any other project files. SeeProject Definition Files.

  5. To review changes, right-click thefind_top_modelsfile in theModifiedfiles view and selectCompare>Compare to Ancestor.

    The MATLAB Comparison Tool opens a report comparing the modified version of the file in your sandbox against its ancestor stored in the version control tool. The comparison report type can differ depending on the file you select. If you select a Simulink®model toCompare>Compare to Ancestor, this command runs a Simulink model comparison.

To compare models, try the following example.

  1. In the Files view, select theProject (number of files)tab, and expand themodelsfolder.

  2. Either double-click to open theAnalogControlfile for editing from the project, or right-click and selectOpen.

  3. Make a change in the model, such as opening a block and changing some parameters, and then save the model.

  4. To review changes, select theModified (number of files)tab. Right-click the modified model file and selectCompare>Compare to Ancestor.

    The Comparison Tool opens a report.

Run Dependency Analysis

To check that all required files are in the project, run a file dependency analysis on the modified files in your project.

  1. On theProjecttab, click on the down arrow to expand theToolsgallery. UnderApps, clickDependency Analyzer.

    The dependency graph displays the structure of all analyzed dependencies in the project. ThePropertiespane lists required products, add-ons, and any problem files.

  2. To highlight the problem files, in thePropertiespane, in theProblemssection, point to the messageFile not in Projectand click the magnifying glass icon.

  3. Select the dependency arrow to examine the dependency type.timesthree.mexw64is an S-function binary file required byf14_airframe.slx. You can add binary files to your project or, as in this project, provide a utility script that regenerates them from the source code that is part of the project.

  4. To remove the file from the problem files list, right-click the file and selectHide Warnings. The next time you run a dependency analysis, the file does not appear as a problem file.

    In this example, you do not want to add the binary file to the project, but instead use the script to regenerate the binary file from the source code in the project. UseHide Warningsto stop such files being marked as problems.

  5. View dependencies of the modified files.

    1. In the Dependency Analyzer toolstrip, in theViewssection, clickSource Control. The color of each file in the graph now represents its source control status.

    2. In the dependency graph, select the modified files. To select multiple files, pressShiftand click the files.

    3. In the Dependency Analyzer toolstrip, in theImpact Analysissection, clickAll Dependencies.

Run Project Integrity Checks

To make sure that your changes are ready to commit, check your project. To run the project integrity checks, on theProjecttab, click the down arrow to expand theToolsgallery. UnderProject Checks, clickCheck Project. The checks look for missing files, files to add to source control or retrieve from source control, and other issues. The checks dialog box can offer automatic fixes to problems found. When you click aDetailsbutton in the Checks dialog box, you can view recommended actions and decide whether to make the changes.

Commit Modified Files

修改后文件和满意the results of the checks, you can commit your changes to the source control repository.

  1. In the Files view, select theModified (number of files)tab. The files you changed appear in the list.

  2. To commit your changes to source control, on the Project tab, in the Source Control section, clickCommit.

  3. Enter a comment for your submission, and clickSubmit.

    Watch the messages in the status bar as the source control commits your changes. Git commits to your local repository. To commit to the remote repository, usePushin the Source Control section. SeePull, Push, and Fetch Files with Git

View Project and Source Control Information

  • To view and edit project details, on theProjecttab, in theEnvironmentsection, clickDetails. View and edit details such as the name, description, project root, startup folder, and generated files folders such as theslprjfolder.

  • To view details about the source control integration and repository location, on the Project tab, in the Source Control section, clickGit Details. This Airframe example project uses Git source control.

Alternatively, use the project API to get the current project:

project = currentProject;
You can use the project API to get all the project details and manipulate the project at the command line. SeecurrentProject.

For next steps, seeProject Management.

Related Examples

More About