from Is this MATLAB or Octave? by ioxv.4623
Crude but effective tests of whether code is executed in matlab or octave.

uioctave
function uiIsOctave = uioctave

uiIsOctave = false;
LIC = license('inuse');
for elem = 1:numel(LIC)
    envStr = LIC(elem).feature;
    if strcmpi(envStr,'octave')
        uiIsOctave = true;
        break
    end
end

Contact us at files@mathworks.com