using an if statement to have an intracompatible code between Octave and MATLAB

55 Views Asked by At

On par with this question, I want to have some pieces of code which only run depending if the interpreter is either MATLAB or Octave. For example

if Octave
    % Octave specific code
elseif MATLAB
    % MATLAB specific code
else
    % other stuff
end

both Octave and MATLAB have version or version() command which return

ans = 5.1.0

and

ans =

'9.5.0.1049112 (R2018b) Update 3'

respectively. I could use regex to define a function to distinguish them but I was wondering if there is a more canonical and faster solution?

0

There are 0 best solutions below