File Exchange

image thumbnail

Matlab Daemon

version 1.1 (8 KB) by

A Bash script & Mex program which allows for #!-style scripting against a background Matlab session.



View License

Unfortunately Mathworks has not designed Matlab to behave like the typical Unix interpreter, i.e., there is no #! ("shebang") support similar to Bash, Perl, or Python. This submission demonstrates how to set this up using only about 20 lines of bash (and a small mex program written in C).

To minimize execution time of each #! script, the provided Bash script establishes a background session of Matlab and re-uses this session as needed.

Please see "readme.html" for installation and comments.

Comments and Ratings (5)

Ben Dichter

I'm having trouble using this. I followed your README and when I type ./demo.m I get the following error: "readlink: illegal option -f
usage: readlink [-n] [file ...]" Any ideas?

Joshua Dillon

Joshua Dillon (view profile)

Hi Mathieu. That's the idea--just look at the code--it already does this.

Interesting concept.

It would be really interesting to be able to pipe data to the script. Do you have any idea on how to do that?

Joshua Dillon

Joshua Dillon (view profile)

The script is available here:



Updated documentation.

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today