Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@helper/checkMatlabVersion.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,48 @@ +function checkMatlabVersion +% CHECKMATLABVERSION checks the current MATLAB version. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: CHECKMATLABVERSION checks the current MATLAB version +% complies with that required by LTPDA. +% +% out = utils.helper.checkMatlabVersion() +% +% The MATLAB version is retrieved from the base application variable +% 'matlab_version' which is set by ltpda_startup. +% +% The required version is retrieved from 'ltpda_required_matlab_version' +% which is also set by ltpda_startup. +% +% If the current MATLAB version does not meet the requirement, then an +% error is thrown. +% +% The following call returns an info object for this method. +% +% >> ii = utils.helper.checkMatlabVersion('INFO') +% +% HISTORY: 27-05-08 M Hewitson +% Creation +% +% VERSION: $Id: checkMatlabVersion.m,v 1.4 2010/02/04 06:21:11 mauro Exp $ +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% required version +rv = getappdata(0, 'ltpda_required_matlab_version'); +% current version +cv = strtok(getappdata(0, 'matlab_version')); + +rparts = getParts(rv); +cparts = getParts(cv); + +if (sign(cparts - rparts) * [1; .1; .01]) < 0 + error('### This MATLAB version is not supported by LTPDA. You require version %s or higher', rv) +end + +% This is copied directly from MATLAB's verLessThan function +function parts = getParts(V) + parts = sscanf(V, '%d.%d.%d')'; + if length(parts) < 3 + parts(3) = 0; % zero-fills to 3 elements + end