Main Content

addShortcut

Add shortcut to project

Description

shortcuts = addShortcut(proj,files) adds shortcuts to the specified files in the project. In projects, a shortcut can be used to perform common project tasks such as opening important files and loading data.

To set the shortcut to run at startup or shutdown, see Automate Startup and Shutdown Tasks.

example

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object from the currently loaded project.

openExample("matlab/TimesTableProjectExample")
proj = currentProject;

Create a new file.

filepath = fullfile(proj.RootFolder,"newvariables.mat");
save(filepath)

Add this new file to the project.

projectFile = addFile(proj,filepath)

Add a new shortcut to the new file.

shortcut = addShortcut(proj,filepath);
shortcut = 

  Shortcut with properties:

     Name: "newvariables"
    Group: "General"
     File: "C:\myProjects\examples\TimesTableApp\newvariables.mat"

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Path of the shortcut files, including the file extension, specified as a string array or a cell array of character vectors. The files must be within the project root folder. If the file is not a project file, the function adds it to the project.

Output Arguments

collapse all

Shortcuts, returned as an array of Shortcut objects.

Version History

Introduced in R2019a

expand all