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:
Set up and browse some example project files under source control.
Examine project shortcuts to access frequently used files and tasks.
Analyze dependencies in the project and locate required files that are not yet in the project.
Modify some project files, find and review modified files, compare them to an earlier version, and commit modified files to source control.
Explore views of project files only, modified files, and all files under the project root folder.
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.
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.
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.
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.
Select the Files view.
Right-click in white space and then select New > Folder. Enter a name for the folder. The folder is automatically added to the project.
Right-click the new folder and select Project Path > Add to the Project Path (Including Subfolders).
Open files, make changes, and review the changes.
Select the Files view. View folders using the tree layout, and then expand the
source/timesTableGame.m and select Open.
Make a change in the Editor, such as adding a comment, and save the file.
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.
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
To check that all required files are in the project, run a file dependency analysis on the modified files.
On the Project tab, click Dependency Analyzer.
The dependency graph displays the structure of all analyzed dependencies in the project. The right pane lists required add-ons and any problem files. Observe that there are no problems files listed.
Now, remove one of the required files. Select the project Files view, right click the
source/timesTableGame.m file, and select Remove from Project. Click Remove in the Remove from Project dialog box.
The Dependency Analyzer automatically updates the graph and the Problems section in the Properties pane.
Check again for problems.
In the Dependency Analyzer, in the Properties pane, point to the problem message,
Not in project, under Problems and click the magnifying glass . The graph updates to highlight the problem file,
To view the dependencies of the problem file, in the Impact Analysis section, click All Dependencies.
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.
In the Views section, click Source Control. The graph colors the files by source control status.
Select the modified files in the graph or in the File List.
To view the dependencies of the modified files, in the Impact Analysis section, click All Dependencies.
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.
After you modify files and you are satisfied with the results of the checks, you can commit your changes to the source control repository.
In the Files view, select the Modified (
number of files) tab. The files you changed appear in the list.
To commit your changes to source control, on the Project tab, in the Source Control section, click Commit.
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.
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.
Click the at the top right corner of the project window to close the project.
proj = currentProject; close(proj);