~ubuntu-branches/ubuntu/hardy/suitesparse/hardy

« back to all changes in this revision

Viewing changes to MATLAB_Tools/getversion.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere, Rafael Laboissiere, Ondrej Certik
  • Date: 2008-02-21 14:46:50 UTC
  • mfrom: (1.1.2 upstream) (5.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080221144650-tgeppgj0t7s759i8
Tags: 3.1.0-3
[ Rafael Laboissiere ]
* Upload to unstable

[ Ondrej Certik ]
* XS-DM-Upload-Allowed: yes field added
* Ondrej Certik added to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
% of MATLAB versions.
 
6
%
 
7
% As of MATLAB 7.5, the version numbers are listed below:
 
8
%
 
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
 
20
%   ...
 
21
%   5.3.1.something (R11.1)             5.31
 
22
%   3.2 whatever                        3.2
 
23
%
 
24
% Example:
 
25
%
 
26
%       v = getversion ;
 
27
%       if (v >= 7.0)
 
28
%           this code is for MATLAB 7.x and later
 
29
%       elseif (v == 6.52)
 
30
%           this code is for MATLAB 6.5.2
 
31
%       else
 
32
%           this code is for MATLAB versions prior to 6.5.2
 
33
%       end
 
34
%
 
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.
 
37
%
 
38
% See also version, ver, verLessThan.
 
39
 
 
40
% Copyright 2007, Timothy A. Davis, Univ. of Florida
 
41
 
 
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.
 
46
 
 
47
v = sscanf (version, '%d.%d.%d') ;
 
48
v = 10.^(0:-1:-(length(v)-1)) * v ;