vernum.m

vernum - returns the current version of Matlab as a number
1.1K Downloads
Updated 30 Jun 2006

No License

vernum - returns the current version of Matlab as a number

30 June 2006 - Created
by David S. Ciochetto and Audrey Barnett, Dalhousie Oceanography
30 June 2006 (Last modified) by David S. Ciochetto

This function gets the current version of matlab and converts it to a real number through the first decimal point. It is intended to be used to delimit cases where code is specific to particular Matlab versions. It is particularly useful for < or > a specific version such as when someone writes to you and says hey, this does not work for Matlab 3... you can use vernum in your code to add a patch with case or if statements to write code that works for the older versions.

It is intended to make detection of the version automatic in your code so it keeps the users of your scripts happy since they do not need to go in and fix the code for their specific version.

Example
if vernum < 7.1 % The below works for Matlab versions earlier than 7.1
% Add code
else % works for newer code
% Add fancy code here
end

Cite As

Dave Ciochetto (2026). vernum.m (https://www.mathworks.com/matlabcentral/fileexchange/11602-vernum-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Workspace Variables and MAT Files in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

Add a ';' to prevent unwanted output to screen.