Main Content

addShortcut

Add shortcut to project

Description

example

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, seeSpecify Startup and Shutdown Files.

Examples

collapse all

Open the Times Table App project. UsecurrentProjectto create a project object from the currently loaded project.

matlab.project.example.timesTable 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 amatlab.project.Projectobject. UsecurrentProjectto 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

Shortcutobject containing information about the shortcut.

Version History

Introduced in R2019a