• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

diffplug/matconsolectl: Control MATLAB from Java, forked from matlabcontrol

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

diffplug/matconsolectl

开源软件地址(OpenSource Url):

https://github.com/diffplug/matconsolectl

开源编程语言(OpenSource Language):

Java 99.7%

开源软件介绍(OpenSource Introduction):

MatConsoleCtl: Control MATLAB from Java

Maven artifact Latest version Javadoc License Apache

Changelog Travis CI

MatConsoleCtl is a Java API that allows calling MATLAB from Java. You can eval, feval, as well as get and set variables. Interaction can be performed from either inside MATLAB or outside MATLAB (both by starting a new MATLAB or by connecting to an existing MATLAB).

MatlabProxyFactoryOptions.Builder builder = new MatlabProxyFactoryOptions.Builder();
// setup the factory
//    setCopyPasteCallback() connects to an existing MATLAB by copy-pasting a few lines into the command window
//    setUsePreviouslyControlledSession() starts a new MATLAB or connects to a previously started MATLAB without any user intervention

MatlabProxyFactory factory = new MatlabProxyFactory(builder.build());
// get the proxy
MatlabProxy proxy = factory.getProxy();
// do stuff over the proxy
proxy.eval("disp('hello world!)")
proxy.setVariable("a", 5.0);
Object a = proxy.getVariable("a");
double actual = ((double[]) result)[0];
assert(actual == 5.0)
// disconnect the proxy
proxy.disconnect();

Javadoc links for MatlabProxyFactoryOptions.Builder and MatlabProxy.

Contributions are welcome, see the contributing guide for development info.

Demo

MatConsoleCtl includes a demo GUI. Below is a script you can use to run the demo inside of MATLAB:

version = '4.6.0';
tempdir = 'matconsolectl_demo';

% make a directory to copy the jar into
mkdir(tempdir);
% download the jar
URL = ['https://repo1.maven.org/maven2/com/diffplug/matsim/matconsolectl/' version '/matconsolectl-' version '.jar'];
filename = [tempdir '/matconsolectl-' version '.jar'];
websave(filename,URL);
% add it to the path
javaaddpath([pwd '\' filename]);

% run it
matlabcontrol.demo.DemoMain

You can also run the demo outside of MATLAB by downloading the jar, then running java -jar matconsolectl-4.6.0.jar at a console.

Compatibility

MatConsoleCtl works on Win/Mac/Linux, MATLAB R2007b through R2016b, and it will continue to work so long as MATLAB maintains the Java MATLAB Interface.*

* On OS X 10.5, R2009a and earlier, you will need to do some hacking. matlabcontrol requires Java 6, and Apple only released 64-bit Java 6 for OS X 10.5, while MATLAB only released 32-bit MATLAB for R2009a and earlier. There are unofficial ways to run 32-bit Java 6 on OS X 10.5.

Acknowledgements

This is forked from the matlabcontrol project originally maintained on the now-defunct Google Code. The name was changed to ensure that we don't infringe the original project's license, but we did not change the package names, so this project is binary compatible with the original matlabcontrol. We are very thankful to Joshua Kaplan for creating matlabcontrol, but this fork is in no way associated with or endorsed by any authors of the original project.

We have fixed some bugs and added some features (see the changelog), and we will maintain this library into the future. We're happy to accept pull requests too!




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap