我曾经能够通过系统调用从 Matlab 调用 R:
system('"/usr/bin/R" --no-save < myscript.R')
但是现在,使用 Matlab R2012b 和 R 版本 3.0.0 (2013-04-03) - “Masked Marvel”,我在加载库时遇到错误,即使当我从 shell 运行它时一切正常。我正在运行 MacOSX 10.6.8。
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/stats/libs/stats.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/stats/libs/stats.so, 6):
Symbol not found: __gfortran_pow_r8_i4
Referenced from: /Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libRlapack.dylib
Expected in: /Applications/MATLAB_R2012b.app/sys/os/maci64/libgfortran.2.dylib
in /Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libRlapack.dylib
During startup - Warning message:
package 'stats' in options("defaultPackages") was not found