Main Content

matlab.buildtool.Plan.load

Class: matlab.buildtool.Plan
Namespace: matlab.buildtool

Load plan into workspace

Since R2022b

Description

plan = matlab.buildtool.Plan.load loads a plan from a build file into the MATLAB® workspace. The build file must be named buildfile.m and must be in the current folder. The method returns the plan as a matlab.buildtool.Plan object.

example

plan = matlab.buildtool.Plan.load(fileOrFolder) loads a plan from the specified build file or folder that contains a build file. To maintain valid relative paths in the main function of the build file, the build tool first changes the current folder to the folder containing the build file. Once the plan is in the workspace, the build tool restores the current folder to its original state.

example

Input Arguments

expand all

Name of the build file or the folder that contains a build file, specified as a string scalar or character vector. The value can be a path relative to the current folder or an absolute path.

If you specify a folder, then the build file must be named buildfile.m and be located directly within that folder. (since R2024b)

Example: "C:\work\buildfile.m"

Example: "..\buildfile.m"

Example: "C:\work"

Attributes

Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Load a plan from a build file that exists in the current folder.

Assume that the file buildfile.m is in your current folder. Load a plan from the file.

plan = matlab.buildtool.Plan.load;

Now that you have access to the Plan object, you can modify the plan, or plot or run tasks in the plan. For example, plot the tasks in the plan as a dependency graph.

plot(plan)

Load a plan from a build file that exists one level up from the current folder.

Assume that the file buildfile.m is one level up from your current folder. Load a plan from the file.

plan = matlab.buildtool.Plan.load("..\buildfile.m");

Now that you have access to the Plan object, you can modify the plan, or plot or run tasks in the plan. For example, plot the tasks in the plan as a dependency graph.

plot(plan)

Version History

Introduced in R2022b

expand all