slproject.loadProject
(Not recommended) Load project
simulinkproject
is not recommended. Use currentProject
or
openProject
instead. For more information, see Version History.
Description
slproject.loadProject(
loads the
project specified by the projectPath
);.prj
file or folder
projectPath
in the Project Tool, and closes any currently open
project.
loads the project and returns a project object proj
= slproject.loadProject(projectPath
)proj
for manipulating
the project. Use slproject.loadProject
for project automation
scripts.
Examples
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.getCurrentProjects
to get a project object to manipulate
the project at the command line.
openExample('simulink/AirframeProjectExample')
proj = slproject.getCurrentProjects
proj = ProjectManager with properties: Name: 'Simulink Project Airframe Example' Categories: [1x1 slproject.Category] Shortcuts: [1x8 slproject.Shortcut] ProjectPath: [1x7 slproject.PathFolder] ProjectReferences: [1x0 slproject.ProjectReference] Files: [1x30 slproject.ProjectFile] RootFolder: 'C:\Work\Simulink\Projects\airframe'
Find Project Commands
Get the Airframe project.
openExample('simulink/AirframeProjectExample')
proj = slproject.getCurrentProjects;
Find project commands.
methods(proj)
Methods for class slproject.ProjectManager: addFile findCategory addFolderIncludingChildFiles findFile close isLoaded createCategory listModifiedFiles export refreshSourceControl reload removeCategory removeFile
Examine Project Properties
After you get a project object, you can examine project properties.
Get the airframe project.
openExample('simulink/AirframeProjectExample')
proj = slproject.getCurrentProjects;
Examine the project files.
files = proj.Files
files = 1x30 ProjectFile array with properties: Path Labels Revision SourceControlStatus
Examine the labels of the 13th file.
proj.Files(13).Labels
ans = Label with properties: File: 'C:\Temp\airframe\models\AnalogControl.slx' Data: [] DataType: 'none' Name: 'Design' CategoryName: 'Classification'
Get a particular file by name.
myfile = findFile(proj, 'models/AnalogControl.slx')
myfile = ProjectFile with properties: Path: 'C:\Temp\airframe\models\AnalogControl.slx' Labels: [1x1 slproject.Label] Revision: '2' SourceControlStatus: Unmodified
Find out what you can do with the file.
methods(myfile)
Methods for class slproject.ProjectFile: addLabel removeLabel findLabel
Input Arguments
projectPath
— Full path to project file or folder
character vector
Full path to project .prj
file or the path to the project root
folder, specified as a character vector.
Example: 'C:/projects/project1/myProject.prj'
Example: 'C:/projects/project1/'
Output Arguments
proj
— Project
project object
Project, returned as a project object. Use the project object to manipulate and explore the project at the command line.
Properties of proj
output argument.
Project Property | Description |
---|---|
Name | Project name |
Categories | Categories of project labels |
Shortcuts | Shortcut files in project |
ProjectPath | Folders that the project puts on the MATLAB® path |
ProjectReferences | Folders that contain referenced projects |
Files | Paths and names of project files |
RootFolder | Full path to project root folder |
Version History
Introduced in R2013aR2019a: Simulink project API is not recommended
Starting in R2019a, instead of simulinkproject
and related functions,
use the currentProject
or openProject
functions in MATLAB. The Simulink® project API will continue to be supported, but, after R2019a, new features
will be available only if you use the new MATLAB project API. There are no plans to remove the Simulink project API at this time.
You can continue to use simulinkproject
and related functions
listed in methods(simulinkproject)
. New functions added after R2019a,
such as runChecks
and
listImpactedFiles
, do not work with
simulinkproject
. Use currentProject
instead.
The new MATLAB project API is part of the R2019a functionality enabling you to use projects in MATLAB, with or without Simulink. You can now share projects with users who do not have Simulink.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)