isMatlabVer

Version 1.1.0.0 (6,1 KB) von Jan
Compare Matlab version number using < <= > >= ==, considers v7.10, fast Mex
404 Downloads
Aktualisiert 13. Apr 2010

Lizenz anzeigen

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.

Zitieren als

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

Kompatibilität der MATLAB-Version
Erstellt mit R2009a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Whos finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.1.0.0

New description on the FEX

1.0.0.0