Convert IDL code to MATLAB

IDL2Matlab automatically partially converts IDL code to MATLAB / Octave code. However, this project appears to be abandoned; there haven’t been updates in a few years.

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

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

Another possibility is to call IDL from Python or Python from IDL.

Call GDL from Python by simply: import GDL see PYTHON.TXT

Install idl2matlab for Linux: download prereqs and code:

apt install libbison-dev flex

git clone https://github.com/farhi/idl2matlab

cd idl2matlab

Prepare to install in your ~ directory

./configure --prefix=$HOME

Edit Makefile

CFLAGS = -g -fno-stack-protector

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.