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.
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.
In the New Project dialog box, enter a project name, browse to select the folder containing your files, and click OK.
In the Welcome to your project dialog box, click Set Up Project to continue.
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.
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 (
.pfiles), 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.
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:
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.
Blank Projecttemplate if you are creating a project in a folder with existing files and want to set up the project manually. The
Blank Projecttemplate 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.
Simple Projecttemplate if you are creating a project in a new folder and want a blank model. The
Simple Projecttemplate 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.
In the start page, select a template and click Create Project.
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.
- Run a Dependency Analysis
- Create a Project from a Model
- Add Files to the Project
- Work with Project Files
- Create Shortcuts to Frequent Tasks
- Add a Project to Source Control