[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:Distinguishing Octave from Matlab
From: |
Pablo |
Subject: |
Re:Distinguishing Octave from Matlab |
Date: |
Thu, 19 Feb 2009 13:57:14 -0300 |
Sorry to bump in, but I was looking for a way to distinguish octave
from matlab, and I found this thread, with the solution provided by
Ben Abbott:
> Distinguishing between Matlab and Octave may be done as,
>
> v = ver;
> if (strcmpi(v(1).Name,'matlab')
> % Matlab code here
> elseif (strcmpi(v(1).Name,'octave')
> % Octave code here
> end
>
> Ben
However, when I tried it in matlab, I got unexpected results:
>> v=ver;
>> v(1).Name
ans = Aerospace Blockset
>> help ver
VER MATLAB, Simulink and toolbox version information.
VER displays the current MATLAB, Simulink and toolbox version information.
VER(TOOLBOX_DIR) displays the current version information for the
toolbox specified by the string TOOLBOX_DIR.
As stated in the help, the command ver gives a long list of version
numbers (one for each toolbox), so it takes a lot of time, several
seconds on my PC. Moreover, the 'matlab' toolbox is not first in that
list. David Bateman suggested the following:
>> v=ver('matlab')
v =
Name: 'MATLAB'
Version: '7.0.4'
Release: '(R14SP2)'
Date: '21-Jan-2005'
>> v=ver('octave')
v =
0x0 struct array with fields:
Name
Version
Release
Date
That's way faster, and worked fine. I just suscribed to the list to
second his suggestion, in case it wasn't clear that it works better.
So the code should be something like (I haven't tested it in octave)
v1 = ver('matlab');
v2 = ver('octave');
if (strcmpi(v1.Name,'matlab'))
% Matlab code here
elseif (strcmpi(v2.Name,'octave'))
% Octave code here
end
Arnoques
- Re:Distinguishing Octave from Matlab,
Pablo <=