Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab callbacks from Java
Date: Sun, 15 Feb 2009 07:15:09 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 13
Message-ID: <gn8fdt$acs$1@fred.mathworks.com>
References: <ggdepe$2hu$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1234682109 10652 172.30.248.37 (15 Feb 2009 07:15:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 15 Feb 2009 07:15:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:518318


"Shawn Hershey" <shliabnt@gmail.com> wrote in message <ggdepe$2hu$1@fred.mathworks.com>...
> I am currently developing a library for Matlab users at my company.  The functions in the library are such that I hope to write the code in Java or C++ rather than in M.  I have written Java code that is called by Matlab in the past and find it to be a nice interface, but this time I require my library functions make calls back to Matlab (ideally via function handles).  This seems to be possible using C or C++ Mex files, but I was hoping to code in Java, not C/C++.  Google searches haven't yielded any obvious solution.  Is it not actually possible to do something like the following:
> 
> 1) Make a Java call from matlab
> 2) From the called Java function, make multiple Matlab calls (either using Matlab function handles, function names, or anything else).
> 
> If this is possible, great!  If not, I'm assuming I can do what I want using C/C++ MEX files.
> 
> Thanks in advance for your insight.

What you require is JMI (Java-Matlab interface) - it's available but undocumented and discouraged by Matlab for reasons unknown. You can google JMI or search this forum for some references. Xtargets (http://www.xtargets.com/snippets/tag/jmi) and JMatLink (http://www.held-mueller.de/JMatLink/) are also good starting points. You can also explore the jmi.jar package which is bundled with Matlab (in the ...\Java\jar\ folder).

Yair Altman