| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
verLessThan(toolbox, version)
verLessThan(toolbox, version) returns logical 1 (true) if the version of the toolbox specified by the string toolbox is older than the version specified by the string version, and logical 0 (false) otherwise. Use this function when you want to write code that can run across multiple versions of the MATLAB software, when there are differences in the behavior of the code in the different versions.
The toolbox argument is a string enclosed within single quotation marks that contains the name of a MATLAB toolbox folder. The version argument is a string enclosed within single quotation marks that contains the version to compare against. This argument must be in the form major[.minor[.revision]], such as 7, 7.1, or 7.0.1. If toolbox does not exist, MATLAB generates an error.
To specify toolbox, find the folder that holds the Contents.m file for the toolbox and use that folder name. To see a list of all toolbox folder names, enter the following statement in the MATLAB Command Window:
dir([matlabroot '/toolbox'])
The verLessThan function is available with MATLAB Version 7.4 and subsequent versions. If you are running a version of MATLAB prior to 7.4, you can download the verLessThan M-file from the following MathWorks Technical Support solution. You must be running MATLAB Version 6.0 or higher to use this M-file:
http://www.mathworks.com/support/solutions/data/1-38LI61.html?solution=1-38LI61
These examples illustrate usage of the verLessThan function.
if verLessThan('simulink', '4.0')
error('Simulink 4.0 or higher is required.');
endif 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
Find the name of the Data Acquisition Toolbox folder:
dir([matlabroot '/toolbox/d*']) daq database des distcomp dotnetbuilder dastudio datafeed dials dml dspblks
Use the toolbox folder name, daq, to compare the Data Acquisition Toolbox software version that MATLAB is currently running against version number 3:
verLessThan('daq', '3')
ans =
1ver, version, license, ispc, isunix, ismac, dir
![]() | verctrl | version | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |