The most recent version of Matlab, 2016b, contains a new Engine API
for Java [1] which is a significant simplification over previous
methods of accomplishing this.
I've been experimenting with using it to access Matlab from an ImageJ
plugin. I've attached some sample code. I can set and get Matlab
variables and call Matlab functions successfully. However, if I try to
open a new window (e.g. via Matlab's "figure" function on line 42),
ImageJ crashes. When I try debugging it in Visual Studio, it reports:
Unhandled exception at 0x000000005ED04F44 (jvm.dll) in ImageJ.exe:
0xC0000005: Access violation reading location 0x0000000000000000.
That looks like Java's version of a null pointer exception.
It's entirely possible I'm doing something wrong on my end. But that
call to figure worked just fine when I tried it in Matlab's demo
code. Is ImageJ doing anything that would prevent an external process
from creating a window?
Walt
1.
http://www.mathworks.com/help/matlab/matlab-engine-api-for-java.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html