How do I detect if I’m running MATLAB or Octave?

You could use the following test to differentiate Octave from MATLAB:

isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0;

Leave a Comment