Main Content

matlab.addons.toolbox.toolboxVersion

Query or modify version of toolbox

Description

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

example

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

example

Examples

collapse all

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

toolboxFile = 'myToolbox.mltbx';
currentVersion = matlab.addons.toolbox.toolboxVersion(toolboxFile) 
currentVersion =

1.5.2

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

toolboxFile = 'myToolbox.prj';
newVersion = '2.0';
previousVersion = matlab.addons.toolbox.toolboxVersion(toolboxFile,newVersion)
previousVersion =

1.5.2

Verify that the version number is now 2.0.

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

2.0

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

matlab.addons.toolbox.toolboxVersion('myToolbox.mltbx')
ans =

1.5.2

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

Input Arguments

collapse all

Name of the toolbox file, specified as a character vector or string scalar. The name includes the relative or absolute path to the toolbox file.

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

If you are setting the toolbox version, toolboxFile must be a toolbox project file (.prj).

Example: toolboxFile = 'myToolbox.mltbx'

Example: toolboxFile = "C:\Work\myOtherToolbox.prj"

New toolbox version number, specified as a character vector or string scalar. Enter the toolbox version number in the Major.Minor.Bug.Build format. The Bug and Build segments are optional. Each segment of the version number is an integer.

Example: newVersion = "2.0"

Example: newVersion = '3.7.12.2'

Alternatives

You can query the version number of your toolbox from the Add-On Manager UI. For more information, see Get and Manage Add-Ons.

You can update the version number of your toolbox from the Package a Toolbox UI. For more information, see Create and Share Toolboxes.

Version History

Introduced in R2016a