Automate Startup Tasks with Shortcuts

In Simulink® Project, startup shortcuts help you set up the environment for your project.

Startup shortcut files are automatically run (.m files), loaded (.mat files), and opened (Simulink models) when you open the project.

    Note:   Files named startup.m on the MATLAB® path run when you start MATLAB. If your startup.m file calls the project with simulinkproject, an error appears because no project is loaded yet. To avoid the error, rename startup.m and use it as a project startup shortcut instead.

Projects warn if you have more than one startup shortcut. Startup shortcuts run in alphabetical order. If execution order is important, consider creating one script that calls all the others, and use that script as your only startup shortcut.

Create a new startup shortcut file.

  1. In the Shortcut Management view, click Create Action Shortcut > Startup Script.

  2. Name and save the file. Startup shortcut scripts can have any name. You do not need to use startup.m.

    The tool adds the new file to the project and sets it to Run at Startup.

  3. Right-click the file and select Open.

  4. Write the shortcut script using the Editor.

  5. Click Save.

Configure an existing file as a shortcut to run when you open your project.

  1. Right-click the file in the All Files or Project Files view and select Create Shortcut > General, or if you have created a shortcut group you want to use, then select Create Shortcut > GroupName. You can change shortcut group later.

  2. Click Shortcuts.

  3. Right-click the shortcut file and select Set Shortcut Action > Startup .

    The Action column displays Run at Start Up.

    Note:   Shortcuts are included when you commit modified files to source control. Any startup shortcuts you create run for all other project users.

To stop a shortcut running at startup, change back to a basic shortcut using Set Shortcut Action > None.

Related Examples

More About

Was this topic helpful?