isMatlabVer

Versione 1.1.0.0 (6,1 KB) da Jan
Compare Matlab version number using < <= > >= ==, considers v7.10, fast Mex
404 download
Aggiornato 13 apr 2010

Visualizza la licenza

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.

Cita come

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

Compatibilità della release di MATLAB
Creato con R2009a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.1.0.0

New description on the FEX

1.0.0.0