Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Callilng Matlab from Java

Subject: Callilng Matlab from Java

From: Uriel

Date: 6 Aug, 2007 19:25:00

Message: 1 of 6

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 6

"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 6

"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 6

"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 6

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.

Subject: Callilng Matlab from Java

From: John Dick

Date: 19 Apr, 2010 22:01:08

Message: 6 of 6

"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
>
>




http://jamal.sourceforge.net does what you need. You can call Matlab functions from java and return the output back.

Tags for this Thread

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.

Contact us