Main Content

export

Export project to archive

Description

example

export(proj,archiveName) exports the specified project to a new project archive file named archiveName.

The project archive preserves the project files, structure, labels, and shortcuts, and does not include any source control information. You can use the project archive to send the project to customers, suppliers, or coworkers who do not have access to your source control repository. Recipients can create a new project from the archive by double-clicking the project archive file.

By default, this function packages all the project references in the archive. You might not want this option if the project contains references to absolute networks paths. In this case, the function duplicates the project itself and treats it as a relative reference upon extraction.

example

export(proj,Name=Value) exports the specified project to a new project archive file with additional options specified by one or more name-value arguments. Use this syntax to omit project references from the archive, specify an export profile, and more.

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;

Export the project to an archived project file.

export(proj,"timestableproj.mlproj");

You can now send the project by sharing the file timestableproj.mlproj.

Open the project you want to export and create a project object.

proj = openProject("myProject.prj");

Export a subset of project files with a user-defined export profile named excludetests. See Create an Export Profile.

export(proj,"myProjectArchive.mlproj",ExportProfile="excludetests");

Open the project and create a project object.

proj = openProject("myProject.prj");

Export all files required by the file mymodel.slx.

requiredFiles = listRequiredFiles(proj,"mymodel.slx");
export(proj,"myModelDependencies.mlproj",Files=requiredFiles);

Input Arguments

collapse all

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

Archive file name or path, specified as a character vector or string scalar ending in the file extension .mlproj or .zip. If you do not specify an extension, MATLAB® appends the .mlproj extension to the file name.

If archiveName is a filename, MATLAB exports the file to the current folder. You also can specify a fully qualified path name.

Example: "projectArchive.mlproj"

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: export(proj,"archivewithnoReferences.mlproj",ArchiveReferences=false)

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: export(proj,"archivewithnoReferences.mlproj","ArchiveReferences",false)

Option to include references in the package, specified as a numeric or logical 1 (true) or 0 (false).

If you specify true, MATLAB exports the project and includes the references in the package. Extracting the archive creates a copy of the referenced projects and links them to the top-level project. It also includes a copy of projects referenced by your referenced projects.

If you specify false, MATLAB exports the project and preserves the existing absolute and relative link to the references. To ensure the top-level project does not have missing references when you extract the archive, references must exist at the same absolute and relative paths.

If the project has no references, the option does not apply.

Data Types: logical

Option to specify the export profile name, specified as a character vector or string scalar.

If specified, MATLAB exports a subset of the project files specified by ExportProfile. Export profiles do not apply changes to referenced projects. When you share your project, MATLAB exports the entire referenced project.

Data Types: char | str

Files to export, specified as a string array, a cell array of character vectors, or an array of ProjectFile objects.

Option to ignore the missing files error and allow exporting a project that has missing files, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Version History

Introduced in R2019a

expand all