Distinguishing Octave from Matlab

Søren Hauberg soren at hauberg.org
Fri Feb 15 04:25:40 CST 2008


fre, 15 02 2008 kl. 11:02 +0100, skrev David Bateman:
> A function that does what you want is
> 
> function ret = isoctave ()
>   persistent isoct
>   if (isempty (isoct))
>      isoct = exist('OCTAVE_VERSION') ~= 0;
>   end
>   ret = isoct;
> end
Is the 'exist' call really so slow that you need to use a persistent
variable? Wouldn't it be just as good to use

function ret = isoctave ()
  ret = (exist('OCTAVE_VERSION') ~= 0);
endfunction

?

Søren



More information about the Help-octave mailing list