view m-toolbox/classes/+utils/@helper/checkMatlabVersion.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

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