help-octave
[Top][All Lists]
Advanced

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

Re: Check if the environment is Octave or Matlab


From: Steph Bredenhann
Subject: Re: Check if the environment is Octave or Matlab
Date: Fri, 10 Apr 2020 20:47:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2020/04/10 16:17, PhilipNienhuis wrote:
José Luis García Pallero wrote
Hello,

Sometimes I need to check if a function or script is running in Octave
or Matlab. Usually I make the check as

if exist('OCTAVE_VERSION')
    octave = 1;
else
    octave = 0;
end

Is this the FASTEST way to check the environment or is there any other
method more suitable?
We have more or less the same in a function "ïsOctave.m" (maybe even with a
persistent variable inside). That function lives in our script library (a
collection of dedicated m-file subdirs) that is in a path set up in a
startup script called by both Matlab and Octave.
No idea if it's faster (I do suspect some function calling overhead) but as
a function it's easy to put in an if clause:
if (isOctave)
  ...
else
  ...
end %if

Philip




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



I tried isOctave with following results

>> isOctave
error: 'isOctave' undefined near line 1 column 1
>>

Is there a package that I should load? I run Octave 5.2 on Ubuntu 18.04.3

--
Steph

reply via email to

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