|
"Bill York" <BillDotYork@MathWorks.com> wrote...
> Uriel, could you tell me more about why you want to call
> MATLAB from Java? More importantly, does it need to be
> syncrhonous or not?
A good reason I once wanted to do this was when I wanted to
have a multi-threaded application. Matlab is basically
single-threaded and even timers & HG callbacks, which should
run in separate threads, actually use only the one
single-threaded computational engine, AFAIK. I thought that
calling the Matlab computational engine from Java treads
would do the trick. Unfortunately it did not, since Matlab
is not only single-threaded, but actually blocks until
processing is done, preventing re-entrancy. Having a
reentrant and truly multi-threaded engine is a wet dream,
but I must admit this is a pretty big challenge, so I'm not
really expecting it soon.
Another reason to call Matlab from Java is if you have an
existing Java-based GUI in which you want to incorporate
Matlab-based computations. Since Java enables richer GUIs
than vanilla Matlab, this would be an ideal combination. One
can, of course, design Java GUIs from within Matlab, but
this involves undocumented functions and hacks that few are
familiar or comfortable with (all those awtinvokes...). Not
to mention the fact that profiling or debugging Java called
from Matlab is currently impossible (AFAIK again), while the
reverse is possible.
Yair Altman
|