本教程介绍如何在MATLAB环境中直接调用R语言进行数据分析和统计计算,实现两种编程环境间的无缝集成。
This package is used for calling R language from MATLAB. Most of the files already exist on the Internet, but I wrote five additional files to complement this package.
Here are the steps to use it:
1. In R, enter: `> install.packages(rscproxy)`
2. Install statconnDCOM (the latest version).
3. Download the MATLAB R Link toolbox. Unzip MATLAB RLINK and then paste the unzipped folder into your MATLABs toolbox folder or any other desired location. Make sure to add MATLAB RLINK to your MATLAB path.
4. Use template and function: In `matlab2r.m`, there is a line that reads `matlab2r(y = x^2, x, y);`. The general form of this command is `matlab2r(Rcommand1;Rcommand2;, {variable1, variable2}, {variable1, variable2});` for multiple commands or variables. You can write your MATLAB codes in other places as well.