help-octave
[Top][All Lists]
Advanced

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

Re: How to determine if you are in octave or matlab


From: David Grohmann
Subject: Re: How to determine if you are in octave or matlab
Date: Wed, 02 May 2007 11:28:33 -0500
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

David Bateman wrote:
Eric Chassande-Mottin wrote:
  
function in = inoctave ()
  persistent inout = exist("OCTAVE_VERSION","builtin") != 0;
  in = inout;
endfunction
      
to be compatible with Matlab (I tried with 7.2) as well, this has to
be modified into

function in = isoctave ()
 persistent inout;

 if isempty(inout),
   inout = exist('OCTAVE_VERSION','builtin') ~= 0;
 end;
 in = inout;

return;
    
Damn, yes.. The assignment in the persistent statement is an octave only
thing.. Missed that.. The form you have is the best way..

D.

  

Thanks guys, this is perfect. I suppose it would be vulnerable to "attack" if Mathworks were to decide to randomly include that variable/file/function somewhere in the default install. But I'm not to worried about that.

-- 
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237


reply via email to

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