Reach for your Matlab data with R

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you work with both Matlab and R, the R.matlab package maintained by Henrik Bengtsson on CRAN helps you to connect the two environments by allowing you to read and write Matlab's MAT data file format from R (even if you don't have Matlab installed). This allows you to pass data between Matlab and R via the filesystem.

But if you want to build an integrated R/Matlab workflow, and call Matlab functions directly from R, there is also the reach package by Christoph Schmidt (available on Github). The reach package works with a Matlab installation behind the scenes, by writing scripts for batch execution by Matlab, and exchanging data via files. (This is a simpler integration than the beta Java-based connectivity also provided by R.matlab, but Christoph claims this interface is more robust.) This is all transparent to the user though, who with just R functions is able to:

  • call and execute Matlab functions seamlessly as if they were R functions and return their results directly into the R session
  • convert .mat files into .RData files, and even batch-convert all .mat files contained within a folder
  • launch Matlab scripts, and import the results back into R
  • execute Matlab functions and print their results at the command line
  • exchange list and matrix objects between the two systems

I don't have access to Matlab, so I wasn't able to try R.matlab or the “reach” packagage myself. But if you try it out, let us know how it works.

github (schmidtchristoph): reach

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)