Converting IDL code to MATLAB code automatically

idl2matlab under Windows, Mac or Linux automatically partially converts IDL code to MATLAB / Octave code.

Alternatives to converting IDL code

I avoid converting code because it can introduce subtle errors. Here are some alternatives allowing you to run the unmodified IDL code for free.

free GDL (GNU Data Language)

If the issue is that you don’t want to install IDL, try using free GDL that is compatible with IDL.

Call IDL from Python

call IDL from Python or Python from IDL

Call GDL from Python

from Python, simply import GDL see PYTHON.TXT

Partial conversion of IDL to Matlab idl2matlab

Here’s the partial automatic converter of IDL code to Matlab code.

  1. Download prereqs and code
   apt install libbison-dev flex

   git clone

   cd idl2matlab
  1. Prepare to install in your ~ directory
   ./configure --prefix=$HOME
  1. edit Makefile
   CFLAGS = -g -fno-stack-protector
  1. compile and install under ~
   make && make install

The MATLAB code that idl2matlab produces uses a sort of cumbersome Matlab script that calls its own Matlab functions to do common tasks. The converted code can be further optimized. Still, probably easier than doing it all manually.

You’ll need to know basics of IDL, like what findgen and randomu mean in Matlab. Not plug and play, but not totally manual.