Robin Rye
Robin Rye

Reputation: 480

Matlab script with version dependent command

I've developed a plugin for Matlab using the COM API with late binding in C#. It works for all versions from 2009bSP1 and forward.

However Matlab recently released the 2012b Prerelease which breaks the functionality. I've updated all the C# code to work. The thing that breaks functionality is that Mathworks changed the structure of callbackInfo items. Before it was possible to call:

var = callbackInfo.Model.Name

In 2012b Prerelease they have changed it to

var = callbackInfo.model.Name

Note the lower case "m" in model.

Is there some way for me to decide which one of these to call depending on the version of matlab the script is invoked from?

Best Regards

Robin

Upvotes: 2

Views: 185

Answers (2)

Gunther Struyf
Gunther Struyf

Reputation: 11168

verLessThan allows you to check if the version of a matlab toolbox is older than a user specified string:

if verLessThan('matlab', '7.15') % if earlier release than 7.15
    % your code
end

Upvotes: 3

High Performance Mark
High Performance Mark

Reputation: 78316

You can use the Matlab functions version and ver to get the information you need at run time and branch accordingly. verLessThan might also be of use to you.

Upvotes: 2

Related Questions