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. Examine project shortcuts to access frequently used 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:

openExample('simulink/AirframeProjectExample')

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 specifying openExample('simulink/UsingAProjectWithSVNExample'). The following example shows the options when using Git.

View, Search, and Sort Project Files

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

  2. To see all the files in your sandbox, click All. 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 the x to 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

You can use shortcuts to make scripts easier to 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.slx, is a shortcut.

Regenerate the S-functions.

  1. On the Project Shortcuts tab in the toolstrip, click the shortcut Rebuild 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 the rebuild_s_functions.m file to explore how it works.

Open the top model.

  • On the Project Shortcuts tab, click the shortcut F14 Model to open the root model for this project.

  • To create shortcuts to access frequently used files, select the Files view, right-click a file, and select Create Shortcut.

You can also specify files to run at startup and shutdown. See Automate 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 the utilities folder.

  2. Either double-click to open the find_top_models file for editing from the project, or right-click and select Open.

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

  4. In the project Files view, select the tab Modified (number of files). After editing the file, you see Modified (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 a resources folder. The files stored in the resources folder 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. See Project Definition Files.

  5. To review changes, right-click the find_top_models file in the Modified files view and select Compare > 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 to Compare > Compare to Ancestor, this command runs a Simulink model comparison.

To compare models, try the following example.

  1. In the Files view, select the Project (number of files) tab, and expand the models folder.

  2. Either double-click to open the AnalogControl file for editing from the project, or right-click and select Open.

  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 the Modified (number of files) tab. Right-click the modified model file and select Compare > 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 the Project tab, click on the down arrow to expand the Tools gallery. Under Apps, click Dependency Analyzer.

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

  2. To highlight the problem files, in the Properties pane, in the Problems section, point to the message File not in Project and click the magnifying glass icon .

  3. Select the dependency arrow to examine the dependency type. timesthree.mexw64 is an S-function binary file required by f14_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 select Hide 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. Use Hide Warnings to stop such files being marked as problems.

  5. View dependencies of the modified files.

    1. In the Dependency Analyzer toolstrip, in the Views section, click Source 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, press Shift and click the files.

    3. In the Dependency Analyzer toolstrip, in the Impact Analysis section, click All 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 the Project tab, click the down arrow to expand the Tools gallery. Under Project Checks, click Check 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 a Details button in the Checks dialog box, you can view recommended actions and decide whether to make the changes.

Commit Modified Files

After you modify files and you are satisfied with the results of the checks, you can commit your changes to the source control repository.

  1. In the Files view, select the Modified (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, click Commit.

  3. Enter a comment for your submission, and click Submit.

    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, use Push in the Source Control section. See Pull, Push, and Fetch Files with Git.

View Project and Source Control Information

  • To view and edit project details, on the Project tab, in the Environment section, click Details. View and edit details such as the name, description, project root, startup folder, and generated files folders such as the slprj folder.

  • To view details about the source control integration and repository location, on the Project tab, in the Source Control section, click Git 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. See currentProject.

For next steps, see Project Management.

Related Examples

More About