isMatlabVer

Version 1.1.0.0 (6.1 KB) by Jan
Compare Matlab version number using < <= > >= ==, considers v7.10, fast Mex
404 Downloads
Updated 13 Apr 2010

View License

Compare Matlab version to specified number

In opposite to other similar functions in the FEX, this function is not confused by the version numbers 7.10 (2010a) and 7.1 (R14SP3). Also failing:
sscanf(version, '%f', 1) <= 7.8
and VERLESSTHAN published by Matlab:
http://www.mathworks.com/support/solutions/attachment.html?resid=1-3Z586O&solution=1-38LI61

This C-Mex function takes about 0.6% of the processing time needed by Matlab's VERLESSTHAN('matlab'), so it can be used in repeatedly called functions without wasting too much time.

Match = isMatlabVer(Relop, N)
INPUT:
Relop: Comparison operator as string: '<', '<=', '>', '>=', '=='.
N: Number to compare with as DOUBLE vector with 1 to 4 elements.

OUTPUT:
Match: TRUE if matching, FALSE otherwise.

EXAMPLES:
version '7.8.0.342 (R2009a)' (different results for other version!)
isMatlabVer('<=', 7) % TRUE
isMatlabVer('>', 6) % TRUE
isMatlabVer('<', [7, 8]) % FALSE
isMatlabVer('<=', [7, 8]) % TRUE
isMatlabVer('>', [7, 8, 0, 342]) % FALSE
isMatlabVer('==', 7) % TRUE
isMatlabVer('==', [7, 10]) % FALSE
isMatlabVer('>', [7, 8, 0]) % FALSE (the 342 is not considered!)
version '7.10.1.2 (2010a)':
isMatlabVer('>', [7, 2]) % TRUE

Pre-compiled files: http://www.n-simon.de/mex

Tested: Matlab 6.5, 7.7, 7.8, WinXP 32 bit, compatibility to Linux, Mac, 64 bit is assumed.
Compiler: BCC 5.5, LCC 2.4/3.8, Open Watcom 1.8, MSVC 2008

I'd appreciate suggestions for improvements and bug reports sent through email - thanks.

Cite As

Jan (2024). isMatlabVer (https://www.mathworks.com/matlabcentral/fileexchange/27231-ismatlabver), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

New description on the FEX

1.0.0.0