I have written some code for Matlab/Octave. Basically, they have the same syntax and everything, but, for example, they have different functions for optimization (`linprog`

/`glpk`

,`quadprog`

/`qp`

).

I want to run the same code in both Matlab and Octave and this code suffers from needing different functions in each environment. Until now, I have a variable that tells the programm whether it is running on Matlab or on Octave, but I always have to set this variable manually.

Is there a way that a program can recognise in which environment it runs? So, I want a statement to set the variable `x=1`

, if it is running on Octave and `x=0`

if it is running on Matlab.