2
votes

I am trying to run a Matlab script from a tcl file.

There are examples elsewhere of how to do this (eg Running Matlab Command From Tcl) :

exec {*}matlab -nodisplay -nosplash -nodesktop -r "ScriptTitle; quit"

However, as far as I can see, this works by opening up a new Matlab command window before executing the Matlab script.

However, I want to call the Matlab script as part of a loop, meaning it will be called many times by my tcl code. Each time matlab is called, a new matlab command window is opened. This takes a long time as the new command window has to open and load etc before it does anything. I want to know if there is a way to access an already open matlab command window from tcl? Or, alternatively, is there a more efficient way to run Matlab from tcl that would work well as part of a frequently repeated loop?

1
Hmm, if it is being run like that (so no access to the display) then you might be able to control it via Expect. - Donal Fellows

1 Answers

0
votes

MATLAB has an API engine which can be used to control it remotely. To use it from Tcl, you can write an extension or use Ffidl.