Explore an Example Project

This example uses the Times Table App example project to explore how project tools can help you organize your work.

Using the Times Table App example, we will explore 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 project and locate required files that are not yet in the project.

  4. Modify some project files, find and review modified files, compare them to an earlier 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.

Setup the Example Files

Create a working copy of the Times Table App example project files and open the project. MATLAB® copies the files to an examples folder so that you can edit them. The project puts the files under Git™ source control.

matlab.project.example.timesTable

View, Search, and Sort Project Files

You can view, search, and sort project files by using the Files view.

To view the files in the project, in the Files view, click Project (number of files). When the view is selected, only the files in your project are shown.

To see all the files in your project folder, click All. This view shows all the files that are under the project root, not just the files that are in the project. As a result, this view is useful for adding files to the project.

To view files as a list instead of a tree, in the Layout field at the top right of the Files view, select List.

There are several ways to find files and folders in projects:

  • To search for particular files or file types by name, in any file view, type in the search box or click the Filter button. For example, in the search field, enter the text timestable. The project returns all files and folders that contain the word timestable. Click the to clear the search.

  • To search the content of files, go to the Project tab and click the Search button. Enter a value in the search field and click Enter. For example, enter the word tests. The project displays all files and folders that contain the word tests. Click the to clear the search.

  • To change how files are grouped or sorted, and to customize the columns, click the actions button and select from the available options.

Open and Run Frequently Used Files

You can use shortcuts to make files easier to find in a large project. View and run shortcuts on the Project Shortcuts tab. You can organize the shortcuts into groups.

The Times Table App project contains several shortcuts, including a shortcut to open the project requirements, and another to run all the tests in the project. The shortcuts make these tasks easier for users of the project.

To perform an action, on the Project Shortcuts tab, click the associated shortcut. For example, to open project requirements, click Documentation > Requirements. To run tests, click Test > Run All Tests.

To create a new shortcut, select the Files view, right-click a file, and select Create Shortcut.

Add Folder to Project

Create a new folder and add it to the project path. Adding a project folder to the project path ensures that all users of the project can access the files within it.

  1. Select the Files view.

  2. Right-click in white space and then select New > Folder. Enter a name for the folder. The folder is automatically added to the project.

  3. Right-click the new folder and select Project Path > Add to the Project Path (Including Subfolders).

Review Changes in Modified Files

Open files, make changes, and review the changes.

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

  2. Right-click source/timesTableGame.m and select Open.

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

  4. In the Files view, select the Modified (number of files) tab. After editing the file, you see Modified (2). The file you changed appears in the list.

  5. To review changes, right-click source/timesTableGame.m 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 to its ancestor stored in version control. The comparison report type can differ depending on the file you select. If you select a Simulink® model to compare, this command runs a Simulink model comparison.

* Note - When you open the Times Table App example project, the project shows a modified file in the resources folder. This is a side effect of opening the example project. When editing files in your own projects, only changes that affect file metadata, such as adding a label to a file, create modified files in the resources folder.

Analyze Dependencies

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

  1. In the Views pane, select Dependency Analysis.

  2. Click Analyze. The impact graph displays the structure of all analyzed dependencies in the project. The right pane lists required toolboxes and any problem files. Observe that there are no problems files listed.

Now, remove one of the required files. Select the Files view, right click on the source/timesTableGame.m file, and select Remove from Project. Click Remove in the Remove from Project dialog box.

Check again for problems.

  1. Select the Dependency Analysis view again.

  2. In the Dependency Analysis tab, click Analyze > Reanalyze all.

  3. Hover over the messages under Problems and click Find All to view the files that use a problem file. The graph updates to display only the problem file, timesTableGame.m, and the problem message, Not in project, in the right panel.

  4. To view the dependencies of the problem file, on the Dependency Analysis tab, in the Impact Analysis section, select Find > All Dependencies of Selection.

Now that you have seen the problem, fix it by returning the missing file to the project. Right-click the file and select Add to Project. The next time you run a dependency analysis, the file does not appear as a problem file.

After running a dependency analysis, to investigate the dependencies of modified files, perform an impact analysis.

  1. On the Dependency Analysis tab, in the Impact Analysis section, select Find > All Files.

  2. In the Impact Analysis section, choose Select > Modified Files.

  3. To view the dependencies of the modified files, in the Impact Analysis section, select Find > All Dependencies of Selection.

Run Project Integrity Checks

To make sure that your changes are ready to commit, check your project. On the Project tab, click Run Checks to run the project integrity checks. The checks look for missing files, files to add to source control or retrieve from source control, and other issues. The Checks dialog box offers automatic fixes to problems found, when possible. 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. In Git, you can have both local and remote repositories. These instructions commit to the local repository. To commit to the remote repository, in the Source Control section, click Pull.

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 project details such as the name, description, project root, startup folder, and location of folders containing generated files.

To view details about the source control integration and repository location, on the Project tab, in the Source Control section, click Git Details. The Times Table App example project uses Git source control.

Close the Project

Click the at the top right corner of the project window to close the project.

proj = currentProject;
close(proj);

Related Topics