Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

Is the verLessThan function available back to MATLAB 6.0 (R12)?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-38LI61
Product:   MATLAB
Reported in Release:   R2007a
Platform:   All Platforms
Operating System:   All OS
 

Subject:

Is the verLessThan function available back to MATLAB 6.0 (R12)?

Problem Description:

MATLAB 7.4 (R2007a) introduces a new function called verLessThan that enables you to compare the currently running version of a MATLAB product or toolbox against a version that you specify in the command.

Solution:

For example, you can use verLessThan in the following manner to ensure that code requiring capabilities built into Simulink 6.3 (R14SP3) or later is run on one of the appropriate versions:
if verLessThan('simulink', '6.3')

error('MyCode:simulinkTooOld', 'Simulink 6.3 or higher is required.');

end
The next example shows how you can use verLessThan to write code that can run across multiple versions of MATLAB:

if verLessThan('matlab', '7.0.1')

% -- Put code to run under MATLAB 7.0.0 and earlier here --

else

% -- Put code to run under MATLAB 7.0.1 and later here --

end
Although this function is being introduced in MATLAB 7.4 (R2007a), you can download a version of the function from this solution that you can run on earlier versions of MATLAB (6.0 and later). You must be running MATLAB Version 6.0 or higher to use this M-file. Download the file and put it in a directory on your MATLAB path:


$MATLABROOT\toolbox\matlab\general

where $MATLABROOT in the MATLAB root directory as returned by the MATLABROOT function executed at the command prompt.

See the function reference page or M-file help on verLessThan for more information on how to use this function.

 

Related Documents/Files:

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page