octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Matlab references in docs; distinguishing between ML and Octave


From: Richard Crozier
Subject: Re: Matlab references in docs; distinguishing between ML and Octave
Date: Mon, 25 Mar 2013 13:15:55 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 24/03/2013 20:01, Ben Abbott wrote:
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






here is how I determine if I am in octave or matlab:

function t = isoctave()
% ISOCTAVE.M
% ISOCTAVE  True if the operating environment is octave.
%    Usage: t=isoctave();
%
%    Returns 1 if the operating environment is octave, otherwise
%    0 (Matlab)
%
% ---------------------------------------------------------------
%
% COPYRIGHT : (c) NUHAG, Dept.Math., University of Vienna, AUSTRIA
%             http://nuhag.eu/
%             Permission is granted to modify and re-distribute this
%             code in any manner as long as this notice is preserved.
%             All standard disclaimers apply.

    if exist('OCTAVE_VERSION')
        % Only Octave has this variable.
        t=1;
    else
        t=0;
    end

end

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]