Calling R from MATLAB on a Mac

조회 수: 5 (최근 30일)
the cyclist
the cyclist 2011년 1월 20일
Is there a canonical method for calling R from MATLAB, on a Mac?
  댓글 수: 1
Todd Flanagan
Todd Flanagan 2011년 1월 20일
Glad to see you here.

댓글을 달려면 로그인하십시오.

채택된 답변

Manu R
Manu R 2011년 1월 20일
I've used Rscript with the --vanilla flag successfully from the OS X command line in the past. To use in MATLAB, this is what I'd consider doing.
1. Prepend the following to the top of myscript.R, the program you want to run:
#! /usr/bin/Rscript
2. From the OS X shell, set the executable bit on your program if it hasn't been done:
$ chmod u+x myscript.R
3. Now, you're set up to use the system function in MATLAB:
>> system('~/path_to/myscript.R')
The usual caveats about paths apply.
  댓글 수: 2
the cyclist
the cyclist 2011년 1월 21일
Thanks. I'll try this. Hopefully it works as well as your git script, which I recently started using!
the cyclist
the cyclist 2011년 1월 25일
Thanks. Worked great.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Doug Hull
Doug Hull 2011년 1월 20일
The statistics language, R, is not supported in MATLAB; however, the following link contains MATLAB functions on MATLAB Central and File Exchange that may allow communication from MATLAB to R.
  댓글 수: 1
the cyclist
the cyclist 2011년 1월 20일
Thanks for the reply, Doug, but that looks like a Windows-only solution.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by