Loren on the Art of MATLAB

Turn ideas into MATLAB

What Version is Being Used? 4

Posted by Loren Shure,

Sometimes it's important to have code work in multiple releases of MATLAB, while still taking advantage of new features when they exist. In recent articles, I've talked about the MException class and using try/catch. Here's another tool to add to your collection: verLessThan.

Contents

ver and version

The functions version and ver allow you to query for the MATLAB version and versions of additional products, as well as extra environmental information.

v = version
v =
7.5.0.342 (R2007b)
vmat = ver('matlab')
vmat = 
       Name: 'MATLAB'
    Version: '7.5'
    Release: '(R2007b)'
       Date: '02-Aug-2007'
vsim = ver('simulink')
vsim = 
       Name: 'Simulink'
    Version: '7.0'
    Release: '(R2007b)'
       Date: '02-Aug-2007'

There is additional information supplied when I ask for the information to be displayed instead of assigning it to a variable.

ver simulink
-----------------------------------------------------------------------------
MATLAB Version 7.5.0.342 (R2007b)
MATLAB License Number: DEMO
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 2)
Java VM Version: Java 1.6.0 with Sun Microsystems Inc.
       Java HotSpot(TM) Client VM mixed mode
-----------------------------------------------------------------------------
Simulink                                           Version 7.0        (R2007b)

Trademarks
------------------
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, and xPC
TargetBox are registered trademarks and SimBiology, SimEvents, and
SimHydraulics are trademarks of The MathWorks, Inc. Other product or
brand names are trademarks or registered trademarks of their respective
holders. 

References

Here are the references to the blog articles I mentioned earlier.

Other Compatibility Tools

I know there are other compatibility tools on MATLAB Central as well, such as this one from Tim Davis.

Thoughts?

We make a concerted effort to not introduce incompatibilities without good reason. We also try to supply tools to help you manage and use the new tools alongside older ones. If you have any thoughts or suggestions on the topic of managing compatibility, please share them here.


Get the MATLAB code

Published with MATLAB® 7.5

4 views (last 30 days)  | |

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.