Running R from inside Matlab on Mac OSX

One line of code (plus a textfile with R commands) gets you running R from inside Matlab on your Mac

You are now following this Submission

R has loads of great functions and can be freely installed, but Matlab does a number of things better. For Matlab users the solution is simple: if you don't have time to reprogram the routine, run R code from inside Matlab. You need a working version of R installed on your machine. Then save your R commands into a text file (through Word or other text editor), access R through the unix interface, and execute the file as a batch command. Save outputs (matrices, stats, etc) as files from within your R code and pick them up again from inside Matlab. The Matlab code is so simple that I haven't packaged it as a function - but it took me a while to figure out, so it may be useful to others.

Cite As

Graeme Cumming (2026). Running R from inside Matlab on Mac OSX (https://www.mathworks.com/matlabcentral/fileexchange/29001-running-r-from-inside-matlab-on-mac-osx), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0