isMATLABReleaseOlderThan

Tests whether the running MATLAB release is older than a given release.

Category: Environment and Settings > Platform and License

Syntax

tf = isMATLABReleaseOlderThan(release)

true if the current release was published before release.

Description

The comparison is made on release dates, so it works across a and b releases of different years. It is the recommended way to guard code that depends on a function introduced in a given release, in place of parsing the text from version.

The current release is never older than itself, so asking about the same release returns false.

Input arguments

release
Release name such as 'R2024a'.

Output arguments

tf
Logical scalar.

Example

Compare with other releases

isMATLABReleaseOlderThan('R2024a')
isMATLABReleaseOlderThan('R2023b')
isMATLABReleaseOlderThan('R2020a')
Output
ans = logical
   1
ans = logical
   0
ans = logical
   0

Notes

MatLivre reports itself as MATLAB R2023b, so the first call above returns true.

See also

matlabRelease verLessThan version ver