vercmp

Compares two version numbers.

You are now following this Submission

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 (2026). vercmp (https://in.mathworks.com/matlabcentral/fileexchange/18640-vercmp), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0