In Simulink®Project, startup files help you set up the environment for your project.
Startup files are automatically run (.m
and每分钟
files), loaded (.mat
files), and opened (Simulink models) when you open the project.
Startup scripts can have any name. You do not need to usestartup.m
You can use a file namedstartup.m
on the MATLAB®path which runs when you start MATLAB. If yourstartup.m
file calls the project withsimulinkproject
, an error appears because no project is loaded yet. To avoid the error, renamestartup.m
and use it as a project startup file instead.
Configure an existing file to run when you open your project.
Right-click the file and selectRun at Startup.
Alternatively, on the Simulink Project tab, clickStartup Shutdown. In the Manage Project Startup and Shutdown dialog box, you can add and remove startup and shutdown files. If execution order is important, change the order using the arrow buttons.
In the files view, theStatuscolumn displays an icon and tooltip indicating the file will run at startup.
Startup file settings are included when you commit modified files to source control. Any startup tasks you create run for all other project users.
To stop a file running at startup, change back by right-clicking it and selectingRemove from Startup.
When you open the project, the startup files run. Also, the current working folder changes to the project startup folder. If you want to set the startup folder, on the Simulink Project tab, clickDetailsand edit theStart Upfolder. SeeSpecify Project Details, Startup Folder, and Derived Files Folders.
You can create new startup and shutdown files interactively in the Simulink Project or at the command line. For details, seeaddStartupFile
.