在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):karpathy/MatlabWrapper开源软件地址(OpenSource Url):https://github.com/karpathy/MatlabWrapper开源编程语言(OpenSource Language):C++ 100.0%开源软件介绍(OpenSource Introduction):MatlabWrapperAndrej Karpathy 27 August 2012 This C++ library is a convenience wrapper around Matlab Engine, especially if you use Eigen matrix library for working with matrices. It should be quite easy to adapt it to other library types as well. UsageConsider the simplest example: You have an
MatlabWrapper mw;
mw.sendMat("X", X); // transfer it over to the engine under name "X"
mw.exec("[IDX, C] = kmeans(X, 10);");
Eigen::MatrixXf mat;
mw.receiveMat("C", mat);
// done! That felt good. Now supose you've computing something complicated and would really like to explore it a bit interactively-- do a few plots, run some statistics, etc. No problem: MatlabWrapper mw;
mw.sendMat("X", X);
mw.interact(); This will start an interactive session with matlab right in your shell! You get to type whatever you wish: >> plot(X(:,1), X(:,2)); // interesting!
>> close;
>> hist(X);
>> close; Entering qq will resume the c++ program right where it left off. This is quite great for debugging as well. InstallEigen library is a dependency, and so is Matlab, naturally. If you don't have eigen, install it with
Also make sure you have tcsh, which is require for matlab engine to work
At this point you may want to get the official MATLAB demo to run (see below) then to install this library.
where last line runs a small demo. Naturally, the above will probably not run right away because these things never do. Have a look inside CMakeLists.txt and modify the include/library paths according to your system preferences. I tried to document it as best I could. Getting Matlab Engine to runIf you haven't used Matlab Engine yet, try to get their demo running first. Here is the main documentation: http://www.mathworks.com/help/techdoc/matlab_external/f29148.html In particular of interest is this link on getting their engdemo.c running: http://www.mathworks.com/help/techdoc/matlab_external/bsq776w-1.html#bsq78dr-9 If you can get that running, you're halfway there! Problems I ran across:
Good luck! LicenseBSD |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论