Skip to Main Content Skip to Search
Product Documentation

Organize Large Modeling Projects

Tools for Managing Project Files

You can use Simulink Projects to help you organize your work. Find all your required files, manage and share files, settings, and user-defined tasks, and interact with source control.

Projects can promote more efficient team work and individual productivity by helping you:

See the web page http://www.mathworks.com/products/simulink/simulink-projects/ for the latest information and video demos.

Getting Started with Your Project

You can use projects to manage:

To get started with managing your files with a project:

  1. Open the Simulink Project Tool from the MATLAB command line, by entering:

    simulinkproject

    Alternatively,

    • From the MATLAB Desktop, select File > New > Simulink Project or Start > Simulink > Simulink Project.

    • From the Library Browser or Simulink Editor, select View > Simulink Project.

    The Project Tool opens. In the Project Tool you can create, load, and explore projects; discover and manage required files; interact with source control; and save tasks.

  2. Try an example project to see how the tools can help you organize your work. See Example Project.

  3. Create a new project by selecting Simulink Project > New. See Create a New Project.

  4. Add files to your project from the All Files view, and use the Dependency Analysis view to check required files. See Add Files and Discover Required Project Files

  5. Explore views of your files. See Manage Project Files.

  6. Create shortcuts from the file views to save and run frequent tasks. See Create Shortcuts to Set Up Projects and Run Frequent Tasks

  7. If you use a source control integration, you can use the Modified Files view to review changes, compare revisions, and commit modified files. If you want to use source control with your project, see Interface with Source Control from Projects.

Example Project

Try an example project to see how the tools can help you organize your work.

In the Simulink Demos, under Modeling Features, see Model Management. The example sldemo_slproject_airframe describes how to:

  1. Set up and browse some example project files, under local revision control.

  2. Examine project shortcuts to run set up and shut down tasks, and access frequently used files and tasks.

  3. Analyze dependencies in the example project and locate required files that are not yet in the project.

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

Follow these steps to explore the example project:

  1. Run this command to create a working copy of the project files and open the project:

    sldemo_slproject_airframe

    The project example copies files to your temporary folder so that you can edit them and put them under local revision control. The Simulink Project Tool opens and loads the project. The project is configured to run some startup tasks, including changing the current working folder to the project root folder.

  2. Click the Shortcuts node to view the startup tasks and other shortcuts.

  3. Click the List button at the top right of the Project Tool to view the shortcuts as a list of files.

    You can use shortcuts to run startup or shutdown tasks, and to easily find files within a large project.

    In this example you can see shortcuts for the following tasks:

    • Some files are set as Run at Start Up shortcuts. Startup shortcut files are automatically run (.m files), loaded (.mat files), and opened (Simulink models) when you open the project. You can use these shortcuts to set up the environment for your project. In this example, the file set_up_project.m sets the MATLAB path, and defines where to create the slprj folder. Open the set_up_project.m file to view how it works. The following lines use the project API to get the current project:

      p = Simulink.ModelManagement.Project.CurrentProject;
      projectRoot = p.getRootDirectory;
    • Run at Shutdown shortcuts run before the current project closes. In this example, the file clean_up_project.m resets the environment changes made by set_up_project.m.

    • You can use shortcuts to make scripts easier to find in a large project. The script that regenerates S-Functions is a shortcut so that a new user of the project can easily find it.

    • You can use shortcuts to make the top-level model, or models, within a project easier to find. In this example, the top-level model slproject_f14 is a shortcut.

  4. Use the example shortcuts:

    1. Double-click the shortcut slproject_f14.mdl to open the root model for this project. This model will not run until you compile a required S-Function.

    2. Right-click the shortcut rebuild_s_functions.m and select Run to generate the S-Function. Open this file to view how it works. You may need to run mex -setup if you have not previously used the mex command.

    To create new shortcuts, select the Project Files view, right-click a file and select Create Shortcut. Go to the Shortcuts view to set an existing shortcut to Run at Startup or Run at Shutdown.

  5. Run a file dependency analysis on the files within your project to check that all the files that are required by the project are stored within it.

    1. Click the Dependency Analysis node.

    2. Click the Analyze button.

    3. Review files reported in the Problems tab.

    4. Observe that the S-Function binary, timesthree, is required by the project but is not currently part of it. Click a file in the Problem Files table to view where it is used in the table below.

      You may want to add binary files to your project or, as in this project, provide a utility script that regenerates them from the source code that is part of the project.

    5. Right-click a problem file and select Add External File. The next time you run dependency analysis, this file will not be marked as a problem file.

  6. Modify a file and review changes.

    1. Open and make changes to one of the utility MATLAB files, or one of the models. You can double-click to open files for editing from the Simulink Project, or right-click and select Open.

    2. Click the Modified Files node to see the files that you have modified.

    3. To review changes, right-click a file in the Modified File view and select Compare to Ancestor.

      The MATLAB Comparison Tool opens a report comparing the modified version of the file in your sandbox against its ancestor stored in the version control tool. Comparison type depends on the file you select. If you select a Simulink model, and you have Simulink Report Generator installed, this command runs a Simulink XML Comparison.

    4. To commit your changes to source control, click the Commit Modified Files button.

      The files stored in the .SimulinkProject folder are internal project definition files generated by your changes. These definition files allow you to add a label to a file without checking it out. You should never need to view the definition files directly unless you need to merge, but they are shown so that you know about all the files being committed to the source control system. See Project Definition Files.

  7. You can dock and undock the Simulink Project Tool into the MATLAB Desktop. When docked, the Project menus (such as the Simulink Project menu and Help menu items) integrate into the menus of the MATLAB Desktop, and the Simulink Project menu is visible only when the Simulink Project Tool has focus. If you cannot see the Simulink Project menu, click the Simulink Project Tool.

  8. Click the tree node Project: Simulink Project Airframe to see information about the currently open project, including a description and the location of the project root folder. You can use the check box to set the current working folder to the project root when you open the project.

  9. Click the Source Control node to see information about the source control tool being used by the current project. This project is under the control of the Local Version Control tool.

    For source control information on individual files (e.g., modified, checked out), see the Modifications column in the file management views.

  10. Click the Project Files view to manage the files within your project. Only the files that are in your project are shown.

  11. Click the All Files view to see all the files in your sandbox. This shows all the files that are under the project root, not just the files that are in the project. This view is useful for adding files to the project that exist within your sandbox, but which are not yet part of the project.

  12. In any file view, click the List button at the top right to view the files as a list. Click the "cog" icon Actions button at the top right (as in the Current Folder Browser) to customize the views and to group files.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS