
From:  Geraint Paul Bevan 
Subject:  Re: do_fortran_indexing within functions 
Date:  Mon, 7 Jul 2003 03:29:44 0500 
Useragent:  Mozilla/5.0 (X11; U; Linux i686; enUS; rv:1.0.0) Gecko/20020623 Debian/1.0.00.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; endI 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.regards, Quentin
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; else f = 0; end Geraint.  Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html 
[Prev in Thread]  Current Thread  [Next in Thread] 