Main Content

Create a New Project from a Folder

If you have many files that you want to organize into a project, with or without source control, use the following steps to create a new project.

Note

If you want to retrieve a project from a source control repository, see instead Clone Git Repository or Check Out SVN Repository.

Easily convert a folder of files into a project by using the Folder to Project template in the Simulink® start page. The template automatically adds your files to the project and prompts you to set up the path and startup files. This simple, quick process sets up your project to manage your files and introduces you to project features. When you open the project, it automatically puts the folders you need on the path, and runs any setup operations to configure your environment. Startup files automatically run (.m and .p files), load (.mat files), and open (Simulink models) when you open the project.

To create a new project to manage your files:

  • On the MATLAB® Home tab, select New > Project > From Folder.

  • Alternatively, in the Simulink start page, click the Folder to Project template. You can also, on the Simulation tab, select New > Project > New Project from the Model Editor.

  1. In the New Project dialog box, enter a project name, browse to select the folder containing your files, and click OK.

  2. In the Welcome to your project dialog box, click Set Up Project to continue.

  3. In the Set Up Project (Step 1 of 2) dialog box, optionally choose folders to add to the project path. When you open the project, it adds these folders to your MATLAB search path, and removes them when you close the project. Add project folders to ensure dependency analysis detects project files. To add all project folders, click Add with Subfolders and then select the project folder containing all your subfolders. Alternatively, you can set up the project path later. Click Next.

  4. In the Set Up Project (Step 2 of 2) dialog box, optionally specify startup and shutdown files.

    • Use startup files to configure settings when you open the project. Startup files automatically run (.m and .p files), load (.mat files), or open (Simulink models) when you open the project.

    • Use shutdown files to specify MATLAB code to run as the project shuts down. You do not need to use shutdown files to close models when you close a project, because it automatically closes any project models that are open, unless they are dirty. The project prompts you to save or discard changes.

    Click Add to specify startup or shutdown files. Alternatively, you can setup these files later.

  5. Click Finish and your new project opens. The Folder to Project template automatically adds all your files to the project. The template does not add derived files to your project.

    For next steps, try dependency analysis to visualize the structure of your project, or consider adding source control to help you manage versions. For details, see Run a Dependency Analysis or Add a Project to Source Control.

As alternatives to the Folder to Project template, you can:

  • Create a project from a model by analyzing it for dependent files that you want to put in a project. See Create a Project from a Model

  • Create projects manually, but then you need to add files to the project and configure the path, startup, and shutdown files. To examine the alternative templates, or to use your own templates:

    1. In the Simulink start page, click templates in the list to read the descriptions. If you selected a new project option to open the start page, the list shows only project templates, or you can filter the list for Project Templates using the list next to the Search box.

      • Select the Blank Project template if you are creating a project in a folder with existing files and want to set up the project manually. The Blank Project template creates a project in your selected folder and leaves any other files untouched. You must manually set up the project, for example by adding files to the project, configuring startup files, configuring the project path, etc.

      • Try the Simple Project template if you are creating a project in a new folder and want a blank model. The Simple Project template creates a simple project containing a blank model and some utilities. The model is a shortcut so you can open it from the toolstrip. The project manages your path and the location of the temporary files (slprj folder) when you open and close the project. You can modify any of these files, folders, and settings later.

      • You can create your own templates. See Using Templates to Create Standard Project Settings.

    2. In the start page, select a template and click Create Project.

    3. In the Create Project dialog box, specify your project folder and edit the project name, and click Create Project. You can control the default folder for new projects using the project preferences.

      The Project displays the project files view for the specified project root. You need to add files to the project. See Add Files to the Project.

For next steps using your new project, try dependency analysis to visualize the structure of your files.

Related Examples

More About