Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I need to write code that should run equally well in Octave and on MATLAB. Problem is that it needs to do some GUI stuff, which MATLAB and Octave handle completely differently.

Is there a way I can detect if I'm running MATLAB or Octave, in order to call the right function?

like image 236
lindelof Avatar asked Feb 11 '10 18:02

lindelof


People also ask

Is MATLAB and Octave same?

MATLAB is a matrix laboratory, referred to as language used for technical computations. Octave is programming language used for numerical computations.

Does Octave code run in MATLAB?

Octave is mostly compatible with Matlab. Most matlab functions can be made to run with very little change. With careful coding, you can get your code to run without change in Matlab and Octave.

Is MATLAB faster than Octave?

Well, it has been seen that Matlab is more powerful as compared to Octave. Moreover, Matlab's algorithms are much faster than Octave's algorithms.


Video Answer


1 Answers

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

isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0; 
like image 111
Amro Avatar answered Sep 21 '22 04:09

Amro