Main Content

addShortcut

Add shortcut to project

Description

shortcut = addShortcut(proj,file) adds a shortcut to the specified file 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 Specify Startup and Shutdown Files.

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 file, including the file extension, specified as a character vector or string scalar. Specify the path relative to the project root folder. The file must be within the project root folder.

Output Arguments

collapse all

Shortcut object containing information about the shortcut.

Version History

Introduced in R2019a