From: Lemon F on
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
From: Yair Altman on
"Lemon F" <f.lemon.jin(a)hotmail.com> wrote in message <i394dg$3n8$1(a)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
From: Lemon F on
can anyone give advice??
From: Yair Altman on
"Lemon F" <f.lemon.jin(a)hotmail.com> wrote in message <i3bag7$i96$1(a)fred.mathworks.com>...
> can anyone give advice??


If you would not have double-posted you would have seen that you already received advice (on the other post): http://www.mathworks.com/matlabcentral/newsreader/view_thread/288403
From: Lemon F on
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