Sharing large datasets between Matlab and R

梦想的初衷 提交于 2019-11-30 03:35:54

Couple of ideas, and with the caveat that I know more about the R side of things:

  • Tthe R.matlab package on CRAN can help: This package provides methods to read and write MAT files. It also makes it possible to communicate (evaluate code, send and retrieve objects etc.) with Matlab v6 or higher running locally or on a remote host

  • HDF5, as you suggested, is a possibility but I heard that the R support in CRAN package hdf5 is somewhat basic

  • NetCDF may be an alternative; CRAN has packages RNetCDF, ncdf and ncdf4

  • Use a database, especially a light and file-based one like SQLite or H4 both of which have R support

  • Use a common serialization / de-serialization format; R has support for Google Protocol Buffers via RProtoBuf and Google points to protobuf-matlab for Matlab

  • Write your own! Especially when you only need something basic like large rectangular matrices then nothing will beat a direct binary write; I did this once years ago for Octave (which is close to Matlab). You can extend Matab via mex files; R has its API and helpers like Rcpp. The larger your data sets, the more attractive this may look as you save the conversions.

Matlab use HDF5 natively in last versions ("save" and "load"). There is a package for R. Then HDF5 might be a good solution.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!