Quantcast

Documentation Center

  • Trial Software
  • Product Updates

slproject.loadProject

Load Simulink project

Syntax

  • slproject.loadProject(projectPath); example
  • proj = slproject.loadProject(projectPath) example

Description

example

slproject.loadProject(projectPath); loads the project specified by the .prj file or folder projectPath in the Simulink® Project Tool, and closes any currently open project.

example

proj = slproject.loadProject(projectPath) loads the project and returns a project object proj for manipulating the project. Use slproject.loadProject for project automation scripts.

Examples

expand all

Load Project

Load a project from a folder called 'C:/projects/project1/'. Replace this path with the location of your project.

proj = slproject.loadProject('C:/projects/project1/')

Get Airframe Example Project

Open the Airframe project and use slproject.getCurrentProject to get a project object to manipulate the project at the command line.

sldemo_slproject_airframe
proj = slproject.getCurrentProject
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

Get the Airframe project..

Find project commands.

methods(proj)
Methods for class slproject.ProjectManager:

addFile
export
isLoaded
removeFile
close
findCategory
reload
removeLabel
createCategory
findFile
removeCategory

Examine Project Properties

After you get a project object, you can examine project properties.

Get the airframe project.

Examine the project files.

files = proj.Files
files = 

  1x24 ProjectFile array with properties:

    Path
    Labels

Examine the labels of the eighth file.

proj.Files(8).Labels
ans = 

  Label with properties:

File:  'C:\Temp\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\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 and explore the Simulink Project at the command line.

Properties of proj output argument.

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

See Also

Functions

Was this topic helpful?