Distinguishing Octave from Matlab
José Luis García Pallero
jgpallero at gmail.com
Thu Feb 19 11:44:55 CST 2009
I usually use a function like this:
function [inOctave] = in_octave()
try
OCTAVE_VERSION;
inOctave = 1;
catch
inOctave = 0;
end
What is the difference with the persistent inout =
exist("OCTAVE_VERSION","builtin") != 0; version?
Is the evaluation of exist() function faster than OCTAVE_VERSION and
try-catch statement?
2009/2/19 John W. Eaton <jwe at octave.org>
> On 19-Feb-2009, José Luis García Pallero wrote:
>
> | Here, you have possible solutions:
> |
> | http://www-old.cae.wisc.edu/pipermail/help-octave/2007-April/003809.html
> | http://www-old.cae.wisc.edu/pipermail/help-octave/2007-May/003814.html
>
> Probably the best solution is something similar to David's suggestion of:
>
> function in = inoctave ()
> persistent inout = exist("OCTAVE_VERSION","builtin") != 0;
> in = inout;
> endfunction
>
> but that won't work in Matlab, so you'll need to write it as
>
> function retval = inoctave ()
> persistent inout;
> if (isempty (inout))
> inout = exist ('OCTAVE_VERSION', 'builtin') ~= 0;
> end
> retval = inout;
> end
>
>
> If this isn't in the FAQ, it should be.
>
> jwe
>
--
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090219/df17641f/attachment-0001.html
More information about the Help-octave
mailing list