[R] importing data into R from matlab

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Nov 29 08:19:15 CET 2000

On Wed, 29 Nov 2000, Kurt Hornik wrote:

> >>>>> S McClatchie writes:
> > Colleagues
> > Has anyone out there developed a routine for importing matlab data into 
> > R? 
> > (if you are not familiar with matlab, see 
> > <http://www.mathworks.com/products/tech_computing/>
> > A sub-question concerns importing structured variables from matlab. 
> > Although you can save variables as an ascii file from matlab, you cannot 
> > write a structured variable in matlab into an ascii file without first 
> > converting the structured variable to an unstructured form. Superficially 
> > the structured variable in matlab corresponds to the data frame concept 
> > in S dialects.
> > Since matlab is widely used in oceanography, physics and acoustics it 
> > might be useful (and interesting?) for someone out there to create a data 
> > import function for matlab to R that incorportates the structured variable 
> > to data frame conversion.
> > Or perhaps one already exists?
> I am not aware of one.
> I seem to recall similar questions on the octave-help mailing list a few
> years ago.  Someone even pointed to technical documentation for the file
> format used by Matlab, but I am not sure whether this ever got done.
> In any case, do you have a reference which describes the format?

R 1.2 will come with a data import/export manual, and in researching that  
no method for matlab has come to light.  So if there is one, we would
like to hear of it.  (I have not come across any data analysis package
that can read Matlab files.)
One possibility is to go via another format.  There are means in R (via
addons on CRAN) to read NDF5 and netCDF formats, and my guess is that there
are addons to Matlab to write those.  I turned up a reference to several
for netCDF:


Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list