comparison m-toolbox/classes/+utils/@helper/checkMatlabVersion.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function checkMatlabVersion
2 % CHECKMATLABVERSION checks the current MATLAB version.
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %
5 % DESCRIPTION: CHECKMATLABVERSION checks the current MATLAB version
6 % complies with that required by LTPDA.
7 %
8 % out = utils.helper.checkMatlabVersion()
9 %
10 % The MATLAB version is retrieved from the base application variable
11 % 'matlab_version' which is set by ltpda_startup.
12 %
13 % The required version is retrieved from 'ltpda_required_matlab_version'
14 % which is also set by ltpda_startup.
15 %
16 % If the current MATLAB version does not meet the requirement, then an
17 % error is thrown.
18 %
19 % The following call returns an info object for this method.
20 %
21 % >> ii = utils.helper.checkMatlabVersion('INFO')
22 %
23 % HISTORY: 27-05-08 M Hewitson
24 % Creation
25 %
26 % VERSION: $Id: checkMatlabVersion.m,v 1.4 2010/02/04 06:21:11 mauro Exp $
27 %
28 %
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30
31 % required version
32 rv = getappdata(0, 'ltpda_required_matlab_version');
33 % current version
34 cv = strtok(getappdata(0, 'matlab_version'));
35
36 rparts = getParts(rv);
37 cparts = getParts(cv);
38
39 if (sign(cparts - rparts) * [1; .1; .01]) < 0
40 error('### This MATLAB version is not supported by LTPDA. You require version %s or higher', rv)
41 end
42
43 % This is copied directly from MATLAB's verLessThan function
44 function parts = getParts(V)
45 parts = sscanf(V, '%d.%d.%d')';
46 if length(parts) < 3
47 parts(3) = 0; % zero-fills to 3 elements
48 end