Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a recommended way to repeatedly call matlab from an external program?

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!

like image 694
atomh33ls Avatar asked Jan 14 '23 13:01

atomh33ls


1 Answers

It is not simple. But you can try using COM automation server interface in MATLAB. You need to have Erlang library for interfacing with COM automation servers. With this interface you can create an automation server and then keep sending commands to it. The documentation is available at http://www.mathworks.com/help/matlab/call-matlab-com-automation-server.html. In the documentation there are examples which use Visual Basic code.

like image 79
Navan Avatar answered Feb 02 '23 17:02

Navan