Thread Subject: Call a Matlab function from Java running in matlab.

Subject: Call a Matlab function from Java running in matlab.

From: Johnathan

Date: 1 Jul, 2009 15:27:01

Message: 1 of 1

Hi guys. I really apologize for asking this question, since I'm sure it is either basic or not possible, but I have been reading through the documentation and can't seem to figure this out, since the examples look like they just send and receive variables from the Java methods.

Could anyone give me a short example of how to call a method from a Java object that causes some sort of action to be performed in MATLAB?

For example, I would like to:

1) make a new object of MyClass from MATLAB called MyObject.
2) run MyObject.DoSomethingInMatlab()
3) have a statement in DoSomethingInMatlab() cause MyMatlabFunction to run.
4) have MyMatlabFunction print('You did it!') to the Matlab Console.

I know Matlab doesn't support being called from Java, but I have read that you can (though they neglected to mention how to) call Matlab functions from Java that is running inside of Matlab. I may have misunderstood what exactly "Java running inside of Matlab" meant, but I assumed it just meant Java code that was called from within MATLAB.

In addition, this nice fellow,
http://www.mathworks.de/matlabcentral/newsreader/view_thread/239621
appears to be using java to invoke matlab functions:

"I have a client/server program where the client calls java server code running in MATLAB.
The Server receives an XML filename from the remote client and sends the file name on to a function in MATLAB, the function returns another filename which contains the results of the simulation."

His java code runs in MATLAB and then sends the filename to a function in MATLAB. I would like to write my main method in MATLAB and have the objects it and other methods create have the ability to call a MATLAB function and receive the output.

Any Dice?
Thanks
--John

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 Johnathan 1 Jul, 2009 11:29:02
call Johnathan 1 Jul, 2009 11:29:02
function Johnathan 1 Jul, 2009 11:29:02
rssFeed for this Thread

Contact us at files@mathworks.com