Re: [問題]請問javaMethod這個FUNCTION如何用?? 已回收
※ 引述《Steven0422 (Steven)》之銘言:
: ※ 引述《louliu (必取)》之銘言:
: : 我現在需要跑一個演算法~有donwload原始的java code
: : 不過我現在需要結合matlab來跑~原始software package裡有
: : 講用javaMethod這個function~但因為我完全不懂java...
: : 所以看不太懂這個funtion怎麼用...
: : help javaMethod的結果:
: : Syntax
: : X = javaMethod('method_name','class_name',x1,...,xn)
: : X = javaMethod('method_name',J,x1,...,xn)
: : Description
: : javaMethod('method_name','class_name',x1,...,xn) invokes the static method
: : method_name in the class class_name, with the argument list that matches
: : x1,...,xn.
: : javaMethod('method_name',J,x1,...,xn) invokes the nonstatic method
: : method_name on the object J, with the argument list that matches x1,...,xn.
: : 我不太懂static method和 nonstatic method 和 object J是指什麼??
: static method 不嚴謹的說法 使用該物件不需建立一個實體 比如類別名稱是Class1
: 其中有個方法method1
: 使用時Class1.method1()即可
: nonstatic method要先建立一個實體
: 文中的J即是建立的實體名稱
: 在matlab中使用javaObject這個function來建立一個實體
: ex J = javaObject('java.lang.String','Hello World')
: 不知software package中是否有demo code提供參考
: 不然這樣解釋想必會懂才怪 = =?
: 我自己都不知道在說甚麼了
: 題外話
: 引用第三方的類別
: 記得將新的JAVA類別物件加入到classpath.txt中
抱歉因為我不懂JAVA的基本運作,只知道他是物件導向的程式,
software package裡的matlab code是這樣寫:
parray = javaMethod('getPs',go,i,gene_include);
我看他的java code裡的確有一個function是getPs(我不確定是不是叫做function)
而我run了以後得到了error
??? Error using ==> javaMethod
The second argument to javaMethod must be a Java object array or
a character string specifying the class
Error in ==> go_impute_llsq_l2>similargene at 126
parray = javaMethod('getPs',go,i,gene_include);
所以是第二個input:go 出錯,請問這該如何debug...= ="
感謝您抽空回答!!感激不盡!!
: : 抱歉我蠻弱的...
: : 不知是否有高手可以解釋一下...
: : 感激不盡!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.255.45.243
推
04/17 18:18, , 1F
04/17 18:18, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):