[Top][All Lists]

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

Re: do_fortran_indexing within functions

From: Geraint Paul Bevan
Subject: Re: do_fortran_indexing within functions
Date: Mon, 7 Jul 2003 03:29:44 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1

Quentin Spencer wrote:
There are probably many ways of doing this. Here's my solution:

function [out]  = octave();
%%% detect Octave vs. MATLAB
tmp     = version;
if(tmp(1)=='2') out     = 1;
else            out     = 0;

I put this function in my path so both programs see it, and I use the statement if(octave) in my code to determine which program I'm in when I need it. You'll notice I'm querying the version number. That means this will break in the unlikely scenario that you are using a version 1.x of octave or 2.x of Matlab (both very old versions). That also means you would need to modify this when a 3.x series of octave is released someday.


Alternatively, a test for the existence of the builtin variable OCTAVE_VERSION should work regardless of changes in version number

function f = is_octave()
  if exist ('OCTAVE_VERSION')
    f = 1;
    f = 0;


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]