[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Matlab references in docs; distinguishing between ML and Octave
From: |
Ben Abbott |
Subject: |
Re: Matlab references in docs; distinguishing between ML and Octave |
Date: |
Sun, 24 Mar 2013 16:01:33 -0400 |
On Mar 24, 2013, at 3:46 PM, Philip Nienhuis wrote:
> bpabbott wrote
>> On Mar 24, 2013, at 2:54 PM, Philip Nienhuis wrote:
>>
>>> While perusing the Octave documentation about Java I noted several
>>> references
>>> to Matlab; one in particular about "how to distinguish between Octave and
>>> Matlab".
>>>
>>> 1. Is there a policy about mentioning ML in the Octave docs?
>>> IMO it should be minimized to "only when unavoidable"; but because of
>>> Octave's aim for ML compatibility, references to Matlab are all over the
>>> place.
>>>
>>> 2. What would be a good place in the doc for a description of how to
>>> distinguish between ML and Octave? The Java section is too narrow-scoped.
>>> Dropping this info entirely or referring to the wiki seems a bit
>>> inappropriate to me. I'd find it a bit double-hearted to aim to be
>>> ML-compatible while mentioning nowhere how to differentiate between the
>>> two
>>> in scripts and m-file functions.
>>>
>>> 3. A way to distinguish Octave and ML, that works in both, could be to
>>> use
>>> the "computer" function; I saw that ML and Octave return different
>>> answers
>>> for the first output arg ('win32' and "i686-pc-mingw32", resp.; when
>>> called
>>> with 'arch': 'win32' and "mingw32-i686", resp.).
>>> I don't know what answers Matlab and Octave give on OSX, nor what ML
>>> would
>>> answer on Linux.
>>>
>>> Philip
>>
>> I think the easiest way to distinguish is to use the "ver" command.
>>
>> "x = ver ()" returns a structure array with fields "Name", "Version",
>> "Release", and "Date". For Octave x(1).Name equals "Octave", and for
>> Matlab x(1).Name equals "Matlab".
>
> Good hint.
>
> In Octave ver() gives a fairly big struct array, depending on installed
> packages. (In ML having many toolboxes is at least financially discouraged).
> The call to ver() does take a bit of time:
To exclude the toolboxes, pass the name of the product ...
a = ver ('matlab')
a =
Name: 'MATLAB'
Version: '8.0'
Release: '(R2012b)'
Date: '20-Jul-2012'
a = ver ('Octave')
a =
scalar structure containing the fields:
Name = Octave
Version = 3.7.2+
Release = [](0x0)
Date = [](0x0)
There's no need to check both ...
if (isempty (ver ('Octave'))
% Running Matlab
else
% Running Octave
end
Ben