| MATLAB Function Reference | ![]() |
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.
The toolbox argument is a string enclosed within single quotation marks that contains the name of a MATLAB toolbox directory. 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 directory that holds the Contents.m file for the desired toolbox and use that directory name. To see a list of all toolbox directory names, enter the following command at the MATLAB prompt:
dir([matlabroot '/toolbox'])
The verLessThan function is available with MATLAB Version 7.4. If you are running a version of MATLAB earlier than 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 the proper 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™ directory:
dir([matlabroot '/toolbox/d*']) daq database des distcomp dotnetbuilder dastudio datafeed dials dml dspblks
Use the toolbox directory name, daq, to compare the Data Acquisition version that MATLAB is currently running against version number 3:
verLessThan('daq', '3')
ans =
1ver, version, license, ispc, isunix, ismac, dir
![]() | verctrl | version | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |