Main Content

matlab.addons.toolbox.toolboxVersion

R2026b

Query or modify version of package

Description

currentVersion = matlab.addons.toolbox.toolboxVersion(packageFile) queries packageFile for the current version number. You do not need to install the package to query the version number.

example

previousVersion = matlab.addons.toolbox.toolboxVersion(packageFile,newVersion) sets the package version number to newVersion and returns the previous version number.

example

Examples

collapse all

Assume that you have the myPackage.mltbx package file on your MATLAB® search path. Query the version number.

packageFile = "myPackage.mltbx";
currentVersion = matlab.addons.toolbox.toolboxVersion(packageFile) 
currentVersion =

1.5.2

Assume that you have the myPackage.prj package project file on your MATLAB search path. Update the myPackage version number to 2.0.

packageFile = "myPackage.prj";
newVersion = "2.0";
previousVersion = matlab.addons.toolbox.toolboxVersion(packageFile,newVersion)
previousVersion =

1.5.2

Verify that the version number is now 2.0.

currentVersion = matlab.addons.toolbox.toolboxVersion(packageFile)
currentVersion =

2.0

The version number is updated for the package project file, but not for the MATLAB package file (.mltbx).

matlab.addons.toolbox.toolboxVersion("myPackage.mltbx")
ans =

1.5.2

Rebuild the package to update the .mltbx file. For more information, see matlab.addons.toolbox.packageToolbox.

Input Arguments

collapse all

Package file, specified as a character vector or string scalar. When specifying packageFile, include the relative or absolute path to the file.

If you are only querying the package version, packageFile can be a MATLAB package file (.mltbx) or a MATLAB project file (.prj or .toml).

If you are setting the package version, packageFile must be a MATLAB project file (.prj or .toml).

When specifying packageFile as a MATLAB project file (.prj or .toml), the specified MATLAB project must contain exactly one package task. (since R2026a)

Example: packageFile = "myPackage.mltbx"

Example: packageFile = "C:\Work\myOtherPackage.prj"

New package version number, specified as a character vector or string scalar.

Version syntax follows the Semantic Versioning 2.0.0 format: <major version>.<minor version>.<patch version>, where each version number must be a nonnegative integer, for example 1.2.3. You can optionally specify a pre-release version by adding -<pre-release version> to the end of the version, for example 1.2.3-alpha. Optionally specify a build version by adding +<build version>. (since R2026b)

Example: newVersion = "2.0.1"

Example: newVersion = "1.2.3-alpha"

Alternatives

You can query the version number of your package from the Add-Ons panel. For more information, see Get and Manage Add-Ons.

You can update the version number of your package from the Build Package UI. For more information, see Interactively Create and Share Packages.

Version History

Introduced in R2016a

expand all