Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Callilng Matlab from Java

Subject: Callilng Matlab from Java

From: Uriel

Date: 6 Aug, 2007 19:25:00

Message: 1 of 5

Does anyone know if how to call Matlab Fucntions from a Java
Application (Not calling java objects FROM MATLAB)
?
I have some code and data from Java, but I need to access
functions in Matlab in order to create PeakFit Graphs.

Please Help


Subject: Callilng Matlab from Java

From: Yair Altman

Date: 7 Aug, 2007 15:27:37

Message: 2 of 5

"Uriel " <uribre@yahoo.com> wrote in message
<f97sib$bql$1@fred.mathworks.com>...
> Does anyone know if how to call Matlab Fucntions from a Java
> Application (Not calling java objects FROM MATLAB)?


http://www.mathworks.com/company/newsletters/news_notes/win02/patterns.html
http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html

Note: undocumented & unsupported

Yair Altman
http://www.ymasoftware.com

Subject: Callilng Matlab from Java

From: Bill York

Date: 12 Sep, 2007 23:43:01

Message: 3 of 5

"Uriel " <uribre@yahoo.com> wrote in message
<f97sib$bql$1@fred.mathworks.com>...
> Does anyone know if how to call Matlab Fucntions from a
Java
> Application (Not calling java objects FROM MATLAB)
> ?
> I have some code and data from Java, but I need to access
> functions in Matlab in order to create PeakFit Graphs.
>
> Please Help
>
>

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?

Subject: Callilng Matlab from Java

From: Yair Altman

Date: 22 Sep, 2007 21:56:23

Message: 4 of 5

"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

Subject: Callilng Matlab from Java

From: Timothy Wall

Date: 13 Oct, 2007 13:51:26

Message: 5 of 5

There are some guys using JNA to do this:

https://jna.dev.java.net/servlets/BrowseList?
list=users&by=thread&from=935824

JNA supports all sorts of Java<->native communication, including native->Java
callbacks. It's also cross-platform, and probably runs on more systems than
matlab itself does.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
java Bill York 12 Sep, 2007 19:45:06
java Yair Altman 7 Aug, 2007 11:30:28
undocumented Yair Altman 7 Aug, 2007 11:30:28
java Ned Gulley 6 Aug, 2007 21:28:58
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics