1
function v = getversion
2
%GETVERSION return MATLAB version number as a double.
3
% GETVERSION determines the MATLAB version, and returns it as a double. This
4
% allows simple inequality comparisons to select code variants based on ranges
7
% As of MATLAB 7.5, the version numbers are listed below:
9
% MATLAB version getversion return value
10
% ------------------------------- -----------------------
11
% 7.5.0.342 (R2007b) 7.5
12
% 7.4.0.287 (R2007a) 7.4
13
% 7.3.0.267 (R2006b) 7.3
14
% 7.2.0.232 (R2006a) 7.2
15
% 7.1.0.246 (R14) Service Pack 3 7.1
16
% 7.0.4.365 (R14) Service Pack 2 7.04
17
% 7.0.1.24704 (R14) Service Pack 1 7.01
18
% 6.5.2.202935 (R13) Service Pack 2 6.52
19
% 6.1.0.4865 (R12.1) 6.1
21
% 5.3.1.something (R11.1) 5.31
28
% this code is for MATLAB 7.x and later
30
% this code is for MATLAB 6.5.2
32
% this code is for MATLAB versions prior to 6.5.2
35
% This getversion function has been tested on versions 6.1 through 7.5, but it
36
% should work in any MATLAB that has the functions version, sscanf, and length.
38
% See also version, ver, verLessThan.
40
% Copyright 2007, Timothy A. Davis, Univ. of Florida
42
% This function does not use ver, in the interest of speed and portability.
43
% "version" is a built-in that is about 100 times faster than the ver m-file.
44
% ver returns a struct, and structs do not exist in old versions of MATLAB.
45
% All 3 functions used here (version, sscanf, and length) are built-in.
47
v = sscanf (version, '%d.%d.%d') ;
48
v = 10.^(0:-1:-(length(v)-1)) * v ;