Reach for your Matlab data with R

October 16, 2015
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

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)