Search code examples
matlaboctaveenvironmentgetenv

Ignore certain lines in Octave (but keep them for Matlab)


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

My code was designed using MATLAB and I still use it. However, if I try to run some parts of it using Octave, I get errors. For example, MATLAB code uses pause on which Octave doesn't.

Is there a way to check which programming environment is using the code? For example,

if  invoking_env == 'Matlab'
    % do this
else 
    % ok, so do this
end

I can use getenv('COMPUTERNAME') but in this case the computer name is the same! Thanks.


Solution

  • There is version function both in MATLAB and Octave. They return different values and MATLAB's version have some arguments, that are absent in Octave. Hope that helps.