verLessThan

Tests whether a product's version is older than a given version.

Category: Environment and Settings > Platform and License

Syntax

tf = verLessThan(product, version)

true if the installed product is older than version.

Description

The comparison is made number by number, so '9.10' is later than '9.9'. An unknown product name raises an error ('Unknown product'). The function is used to protect code that needs a minimum version, though isMATLABReleaseOlderThan is easier to read when you know the release name.

Version numbers are not release names: MATLAB R2023b is version 23.2.

Input arguments

product
Product name, such as 'matlab' or a toolbox name.
version
Version text such as '9.0' or '23.2'.

Output arguments

tf
Logical scalar.

Example

Compare with version numbers

verLessThan('matlab', '9.0')
verLessThan('matlab', '23.2')
verLessThan('matlab', '23.3')
Output
ans = logical
   0
ans = logical
   0
ans = logical
   1

See also

version ver matlabRelease isMATLABReleaseOlderThan