f



matlab in JAVA or java in MATLAB? #2

Hi guys

I am now experencing a great difficulty in the interation between java and matlab.

I have an objective function written in JAVA with has method return an numerical number, i call it 'profit'. The nature of this obtive function (ObjFun.java) is that it takes an parameter input, say C, with different C value, the returned profit value is different.

Eventually I want to find the optimized C value which produce the maximun profit (C will be under constrains). Initially I want to use linprog or fminsearch in matlab. So I tried the command in matlab that excutes my ObjFun.java. But it failed because my ObjFun.java will call an external .exe file. and the file path contains spaces which is fine by Java but not matlab. 

I stuck here, I myself is a Java programmer not good at matlab, I can't find any thing on google about the solution to my problem. So here I propose another idea: call matlab function in JAVA. 

I need some advise on this. Thank you very much for a reply!!!

Lemon
0
Lemon
8/3/2010 1:09:04 PM
comp.soft-sys.matlab 211266 articles. 24 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
1346 Views

Similar Articles

[PageSpeed] 37

"Lemon F" <f.lemon.jin@hotmail.com> wrote in message <i394dg$3n8$1@fred.mathworks.com>...
> Hi guys
> 
> I am now experencing a great difficulty in the interation between java and matlab.
> 
> I have an objective function written in JAVA with has method return an numerical number, i call it 'profit'. The nature of this obtive function (ObjFun.java) is that it takes an parameter input, say C, with different C value, the returned profit value is different.
> 
> Eventually I want to find the optimized C value which produce the maximun profit (C will be under constrains). Initially I want to use linprog or fminsearch in matlab. So I tried the command in matlab that excutes my ObjFun.java. But it failed because my ObjFun.java will call an external .exe file. and the file path contains spaces which is fine by Java but not matlab. 
> 
> I stuck here, I myself is a Java programmer not good at matlab, I can't find any thing on google about the solution to my problem. So here I propose another idea: call matlab function in JAVA. 
> 
> I need some advise on this. Thank you very much for a reply!!!
> 
> Lemon


Calling Matlab from Java is undocumented and unsupported. There are several ways you can do this. Here are two links to get you started:

http://UndocumentedMatlab.com/blog/jmi-wrapper-remote-matlabcontrol/
http://code.google.com/p/matlabcontrol/

Yair Altman 
http://UndocumentedMatlab.com 
0
Yair
8/3/2010 5:01:04 PM
Thank you so much for you help, information provided are helpful, and I found a solution using matlab builder ja. which converts matlab codes(inc. matlab lib function) into java library.

Sry for the double post...didn't realise that.

Cheers

Lemon
0
Lemon
8/5/2010 9:30:25 AM
Reply: