0

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?

Community
  • 1
  • 1
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
  • @rinkert possibly. will check. thanks. – Foad S. Farimani May 19 '19 at 14:31
  • @rinkert it seems to be a very similar question. however the answers on that page are not that good either. mostly work around. :( – Foad S. Farimani May 19 '19 at 14:37
  • 1
    I disagree, the second answer (referring to [this](https://wiki.octave.org/Compatibility) wiki) is from the Octave wiki, and thus I see it as the recommended approach. – rinkert May 19 '19 at 14:46
  • There are many ways, but the first two answers in the linked question (which are identical) are the recommended way of doing it. Other methods might break in future releases, this one is future proof. – Cris Luengo May 19 '19 at 15:29

0 Answers0