[Top][All Lists]

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

Detecting Matlab or Octave

From: John W. Eaton
Subject: Detecting Matlab or Octave
Date: Thu, 25 Jul 2002 01:03:04 -0500

On 24-Jul-2002, Julius Smith <address@hidden> wrote:

| Is there some way to detect, inside a function, whether that function is 
| running under Matlab or Octave?
| A really lame method would be to test for facilities that exist in Matlab 
| but not Octave using the exist() function, but of course that fails when 
| the facilities finally appear in Octave.

Why does it fail if Octave later provides the feature you are looking
for (I'm assuming tests like this would be done for each missing
feature that you need to work around)?

| Another lame but possibly more practical method is to analyze the version 
| variable.  (This could be made to work reliably if Octave moved to negative 
| version numbers, an alpha prefix, etc.)

Why should Octave change a perfectly good version numbering scheme for
this purpose?

| Does anyone have a good idea about this, or is there a known good method?

What about

  if (exist ('OCTAVE_VERSION'))
    % Octave-specific stuff here
    % Stuff suitable for the other leading brand goes here



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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