I am repeatedly calling a matlab script MyMatlabScript from another program (written in Erlang). I am doing this using a batch file containing the following:
matlab -nodesktop -nosplash -wait -r "addpath('C:/...'); MyMatlabScript; %quit;"
This means that Matlab has to launch everytime I run the batch file script. It works but is slow*.
To improve performance I would like to be able to launch Matlab once and then somehow, using Erlang or a batch script, repeatedly initiate my Matlab script using that one instance of Matlab.
Can this be done?
Note, I am using Matlab 7.8.0 (R2009a) on Windows7.
*Extra slow due to issue outlined here!
I do not know whether passing messages into Matlab is a viable option, but I would like to propose an alternative. Matlab has a “timer” object, which lets you specify a call-back-function. In regular intervals, the Matlab call-back-function could check a file, which is changed by your Erlang program. A changed file triggers the desired Matlab routine. Well, it is not “haute cuisine” in terms of programming style, but it should do the job.