f



Call a Matlab function from Java running in matlab.

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
0
7/1/2009 3:27:01 PM
comp.soft-sys.matlab 211266 articles. 19 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
1034 Views

Similar Articles

[PageSpeed] 17

Reply: