MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Specify Startup and Shutdown Files


To configure a file to run when you open your project, right-click the file and select Run
at Startup. To configure a file to run when you close your project, right-click the file and
select Run at Shutdown. The Status column displays an icon indicating whether the file
runs at startup or shutdown.

To stop a file from running at startup or shutdown, right-click the file and select Remove
from Startup or Remove from Shutdown.

Alternatively, go to the Project tab and click Startup Shutdown. Then, in the Manage
Project Startup and Shutdown dialog box, use the Add and Remove buttons to manage
the startup and shutdown file lists. The files run from the top down. If the order in which
the files are run is important, use the arrow buttons to move files up or down in the list.

NoteStartup and shutdown files are included when you commit modified files to source
control. When you configure startup and shutdown files, they run for all other project
users.

Startup files can have any name except startup.m. A file named startup.m on the
MATLAB path runs when you start MATLAB. If your startup.m file calls the project, an
error occurs because the project is not yet loaded. For more information about using
startup.m files, see “Startup Options in MATLAB Startup File”.

To create new startup and shutdown files programmatically, see addStartupFile and
addShutdownFile.

In Simulink, you can specify additional project startup options. For more information, see
“Automate Startup Tasks” (Simulink).

See Also
addStartupFile

More About



  • “Manage Project Files” on page 31-12

  • “Create and Edit Projects Programmatically” on page 31-62


31 Projects

Free download pdf