Running java code as a function in Matlab
显示 更早的评论
I am interested in using some of the algorithmic trading code written by the Matlab community (Some examples are in this link: http://www.mathworks.com/matlabcentral/fileexchange/?term=trading ) and working on my own. Most online market APIs provide sample code written in Java, but I am having some issues getting Java code to work in Matlab in the ways I want it to. I want to use Java code like a Matlab function. Ultimately I want to be able to issue buy and sell commands to BTCChina through Matlab. Sample code for doing this with Java can be found here: https://github.com/BTCChina/btcchina-fix-api-java . I tried the build a mex-function technique (found here: http://www.mathworks.com/help/matlab/ref/mex.html#bt2l4qg-3 ) but I can only find documentation for C/C++ or Fortran. If anyone could give me some advice, or point me in the right direction, or if anyone has worked through something similar before, I would really appreciate it.
回答(1 个)
Guillaume
2015-1-6
You can call java code directly from matlab. No need to go through mex (which is indeed only for C/C++ or Fortran).
bigi = java.math.BigInteger('1234567890123456789')
bigp = bigi.nextProbablePrime
r = double(bigp.remainder(java.math.BigInteger(100)))
类别
在 帮助中心 和 File Exchange 中查找有关 Call Java from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!