vercmp

Compares two version numbers.
669 Downloads
Updated 6 Feb 2008

No License

I use it to compare version numbers of data stored by different versions of my software for compatibility reasons.

function result = vercmp(ver1, varargin)
% Compares two version numbers.
%
% Example: 7.4.0.287
% major release.minor release.patch level.build
% Everything except the major release is optional.
%
% Arguments:
% ver1 - Version number one
% ver2 - Version number two; default: version cmd output
%
% Return values:
% result - Index of part which differs:
% 0 if equal
% > 0 if ver1 > ver2
% < 0 if ver1 < ver2
% NaN if ver1 | ver2 are not a version number
%
% Author: Johannes Kissel
% Last modified: 29.01.2008

Cite As

Johannes Kissel (2024). vercmp (https://www.mathworks.com/matlabcentral/fileexchange/18640-vercmp), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0