This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 and .p 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.

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

  1. In the Files view, right-click the project file and select Add Shortcut to > General, or if you have created a shortcut group you want to use, then select Add Shortcut to > GroupName. You can change shortcut group later.

  2. Select Shortcuts Management.

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

    The Shortcut Action column displays Run at Startup.

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.

    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.

If you want to set the start up folder, see the check box option at the root project node: Change current folder to project root on start up. See Change the Project Name, Root, Description, and Startup Folder.

Related Examples

More About

Was this topic helpful?