Create Projects

What Are Projects?

A project is a scalable environment where you can manage MATLAB® files, data files, requirements, reports, spreadsheets, tests, and generated files together in one place.

Projects can help you organize your work and collaborate. Projects promote productivity and teamwork by helping you with common tasks.

  • Find all the files that belong with your project.

  • Create standard ways to set up and shut down the MATLAB environment across a team.

  • Create, store, and easily access common operations.

  • View and label modified files for peer review workflows.

  • Share projects using built-in integration with Git™, Subversion® (SVN), or using external source control tools.

Create Project

To create a blank project, on the Home tab, click New > Project > Blank Project. To create a project from an existing folder, on the Home tab, click New > Project > From Folder.

The New Project dialog box opens. Enter a project name, select a project folder, and click Create.

Open Project

To open an existing project, on the Home tab, click Open and browse to an existing project .prj file. Alternatively, in the Current Folder browser, double-click the project .prj file.

Note

To avoid conflicts, you can have only one project open at a time. If you open another project, any currently open project closes.

To open a recent project, on the Home tab, click the Open arrow and select your project under the Recent Projects list.

Set up Project

After you create a project, the Welcome to your project dialog box opens and prompts you to set up the project.

  1. Click Set Up Project to begin setting up your project.

  2. In the Set Up Project (Step 1 of 2) dialog box, you can choose folders to add to the project path. Adding project folders to the project path ensures that all users of the project can access the files within them. MATLAB adds these folders to the search path when you open the project, and removes them when you close the project.

    To add all the folders in project folder to the project path, click Add with Subfolders and then select the root project folder containing all your subfolders.

    For more information about adding folders to the project path, including how to add them after completing the project setup, see Specify Project Path.

  3. After specifying the project path, click the Next button to continue.

  4. In the Set Up Project (Step 2 of 2) dialog box, you can specify startup and shutdown files. Startup files help you set up the environment for your project. Shutdown files help you clean up the environment when you are done. Use shutdown files to undo the setup that occurs in startup files.

    Use the Add and Remove buttons to manage the startup and shutdown file lists. The files run from the top down. If the order in which the files are run is important, use the arrow buttons to move files up or down in the list.

    For more information about specifying startup and shutdown files, including how to specify them after completing the project setup, see Specify Startup and Shutdown Files.

  5. Click Finish to complete the project setup and open your new project.

Add Files to Project

The Files view shows the list of files in the project. Notice that, after creating a new project, the list is empty. Files in the project root folder are not included in the project until you add them.

To create a new file or folder in the project, in the Files view, right-click in white space and select New Folder or New File. The new file or folder is created and added to the project.

To add existing files to a project, on the Project tab, in the File section, click Add Files. Then, select from the list of files in the project folder that are not yet added to the project. To add existing files from the Files view, click All. Then, right-click one or more files and folders, and select Add to Project or Add Folder to Project (Including Child Files). To add existing files from a file browser or the Current Folder browser, cut and paste or drag and drop the files into the project Files view. If you drag a file from outside the project root folder, this moves the file and adds it to your project. Drag files within the project root to move them.

To add and remove project files programmatically, use the addFile function.

You might not want to include all files in your project. For example, you might want to exclude some files in the project root folder, such as SVN or CVS source control folders. To determine which files need to be included in your project, see Analyze Project Dependencies.

Other Ways to Create Projects

There are several alternative ways to create a project. You can:

  • Create a project from an archived project.

  • Create a project using a Simulink® template.

  • Create a project using files retrieved from an existing source control repository. For more information on this last alternative, see Use Source Control with Projects.

Create a Project from an Archived Project

Some projects are shared as archived projects. An archived project is useful for sharing with users who do not have access to a connected source control tool. To view and edit the contents of an archived project, create a new project from the archived project.

To create a new project from an archived project, in the Current Folder browser, double-click the archived project file which has an .mlproj extension. The Extract Project dialog box opens. Specify the location for the new project and click Select Folder. For example, C:\myNewProject.

The new project opens. The current folder (for example, C:\myNewProject) contains the imported project folders. If the archived project contains referenced projects, MATLAB imports files into two subfolders, mains and refs. The mains project folder (for example, C:\myNewProject\mains) contains the project folders. The refs folder (for example C:\myNewProject\refs) contains the referenced project folders.

Create a Project Using Simulink

If you have Simulink, you can use a Simulink template to create and reuse a standard project structure.

To create a project from a Simulink template created in R2014b or later:

  1. On the Home or Project tab, click New > Project > From Simulink Template. The Simulink Start Page opens.

  2. The start page shows all project templates (*.sltx) on the MATLAB path. Select a template in the list to read the template description.

    If your templates do not appear, locate them by clicking Open. In the Open dialog box, make *.sltx files visible by setting the file type to All MATLAB files, and browse to your template.

  3. Select a template and click Create Project. The Create Project dialog box opens.

    Templates created in R2017b or later warn you if required products are missing. Click the links to open Add-On Explorer and install required products.

  4. Specify the root project folder, edit the project name, and click Create Project.

To use project templates created in R2014a or earlier (.zip files), upgrade them to .sltx files using Simulink.exportToTemplate.

Related Topics