No BSD License  

Highlights from
vercmp

4.0

4.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 1.98 KB File ID: #18640

vercmp

by Johannes Kissel

 

06 Feb 2008 (Updated 06 Feb 2008)

Compares two version numbers.

| Watch this File

File Information
Description

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

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
06 Feb 2008 Duane Hanselman

If you are running matlab only one version number exists, so where do you get the second version number for your input argument? What about the built in function "verLessThan" in R2007a (ver. 7.4)?

07 Feb 2008 Thomas Pieper

Duane,

I think you didn't get the point. vercmp.m is a tool which compares two version numbers produced by ANY software. Comparing Matlab version numbers is a different kettle of fish.

Thomas

08 Feb 2008 Johannes Kissel

That's right.

Another benefit are the detailed informations about the part of the version numbers which differs.

An Example:
If ver1 is smaller than ver2 in minor release the result is -2

OK, for normal Applications it may suffice to know, if the result is 0 or not ;-)

17 Dec 2010 Arthur

I was looking for something like this. thanks.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
version Johannes Kissel 22 Oct 2008 09:46:43
numbers Johannes Kissel 22 Oct 2008 09:46:43
data Johannes Kissel 22 Oct 2008 09:46:43
stored Johannes Kissel 22 Oct 2008 09:46:43
compatibility Johannes Kissel 22 Oct 2008 09:46:43

Contact us at files@mathworks.com