Search code examples
matlabcomerlangmatlab-deployment

How can I call Matlab functions using Erlang?


I would like to call some Matlab functions using Erlang.

I have two separate network models (one comms/control, one energy)

Ideally I would like an Erlang process to send a message which causes some Matlab code to run. After the Matlab code has finished it must notify Erlang.

What is the simplest way of doing this?

I am running Windows 7. Matlab appears to require use of Microsoft Component Object Models which do not seem to be commonly used with Erlang - hence my question...

Thanks,


Solution

  • You can run Matlab statements from the command line:

    matlab -r "statements"
    

    Erlang gives you the opportunity to open ports to execute OS commands. Combining the two features should do the job for you. Have a look to the os:cmd/1 function. For example, you could simply do:

    os:cmd("matlab -r STATEMENT").