Documentation Center

  • Trial Software
  • Product Updates

simulinkproject

Open Simulink Project and get project object

Syntax

  • proj = simulinkproject example
  • proj = simulinkproject(projectPath) example

Description

example

simulinkproject opens the Simulink® Project Tool or brings focus to the tool if it is already open. After you open the tool, you can create new projects or access recent projects using the Simulink Project tab.

example

simulinkproject(projectPath) opens the Simulink project specified by the .prj file or folder in projectPath.

example

proj = simulinkproject returns a project object proj you can use to manipulate the project at the command line. You need to get a project object before you can use any of the other project functions.

example

proj = simulinkproject(projectPath) opens the Simulink project specified by projectPath and returns a project object.

Examples

expand all

Open Simulink Project Tool

Open the Simulink Project Tool.

simulinkproject

Open a Simulink Project

Specify either the .prj file path or the folder that contains your .SimulinkProject folder and .prj file. For example:

simulinkproject('C:/projects/project1/')

Open a Simulink Project and Get a Project Object

Open a specified project and get a project object to manipulate the project at the command line. For example,

proj = simulinkproject('C:/projects/project1/myproject.prj')

Get Airframe Example Project

Open the Airframe project and create a project object to manipulate and explore the project at the command line.

sldemo_slproject_airframe
proj = simulinkproject
proj = 

  ProjectManager with properties:

          Name: 'Simulink Project Airframe Example'
   Categories: [1x2 slproject.Category]
     Shortcuts: [1x6 slproject.Shortcut]
             Files: [1x24 slproject.ProjectFile]
   RootFolder: 'C:\Temp\20121107T135235\airframe'

Find Project Commands

Find out what you can do with your project.

methods(proj)
Methods for class slproject.ProjectManager:

addFile
export
isLoaded
removeFile
close
findCategory
reload
removeLabel
createCategory
findFile
removeCategory            

Examine Project Properties Programmatically

After you get a project object using the simulinkproject function, you can examine project properties.

Examine the project files.

files = proj.Files
files = 

  1x24 ProjectFile array with properties:

    Path
    Labels

Use indexing to access files in this list. The following command gets file number 8. Each file has two properties describing its path and attached labels.

proj.Files(8)
ans = 

  ProjectFile with properties:

      Path: 'C:\Temp\project1\airframe\models\AnalogControl.mdl'
    Labels: [1x1 slproject.Label]

Examine the labels of the eighth file.

proj.Files(8).Labels
ans = 

  Label with properties:

File: 'C:\Temp\project1\airframe\models\AnalogControl.mdl'
            Data: []
        DataType: 'none'
            Name: 'Design'
    CategoryName: 'Classification'

Get a particular file by name.

myfile = findFile(proj,'models/AnalogControl.mdl')
myfile = 

  ProjectFile with properties:

      Path:  'C:\Temp\project1\airframe\models\AnalogControl.mdl'
    Labels: [1x1 slproject.Label]

Find out what you can do with the file.

methods(myfile)
Methods for class slproject.ProjectFile:

addLabel
removeLabel
findLabel

Input Arguments

expand all

projectPath — Full path to project file or folderstring

Full path to project .prj file, or the path to the project root folder, specified as a string.

Example: 'C:/projects/project1/myProject.prj'

Example: 'C:/projects/project1/'

Output Arguments

expand all

proj — Projectproject object

Project, returned as a project object. Use the project object to manipulate the currently open Simulink project at the command line.

Properties of proj output argument.

Project PropertyDescriptionValue
NameProject nameString
CategoriesCategories of project labelsCell array of strings
FilesPaths and names of project filesCell array of strings
RootFolderFull path to project root folderString
ShortcutsShortcut files in projectCell array of strings

More About

expand all

Tips

Alternatively, you can use slproject.loadProject to load a project, and slproject.getCurrentProject to get a project object. Use simulinkproject to open projects and explore projects interactively. Use slproject.getCurrentProject and slproject.loadProject for project automation scripts.

See Also

Functions

Was this topic helpful?