I think the best way is to have a subfunction that tests this. The following snippet is probably one that requires a minimum of system. And with a constant variable, it can be called multiple times without a strong performance hit.
function r = isoctave () persistent x; if (isempty (x)) x = exist ('OCTAVE_VERSION', 'builtin'); end r = x; end
Then you can easily use it in condition blocks. See this entry in the Octave quiz.
source share