[R] R and reading matlab compressed files

Hans W Borchers hwborchers at gmail.com
Mon Nov 19 09:55:57 CET 2007


Prof Leslie Smith <lss <at> cs.stir.ac.uk> writes:

> 
> Is there any way to read these files (standard .mat files, created by
> matlab version 7 onwards are compressed)? I know that R.matlab doesn't
> read them (it even says in the file MatlabServer.m "Matlab v7 saves
> compressed files, which is not recognized by R.matlab's readMat()" (lines
> 47-8)).
> 
> I know I should be able to make R call Matlab and transfer data (not that
> I managed to make it work yet!), but I'd rather not run Matlab & R
> together: I'd like to use R to read matlab files on machines not licensed
> for matlab!
> 
> Are there any ways to make this work?
> 
> --Leslie Smith
> 

You can save data in Matlab with the '-ASCII' option (see 'help save') which 
makes them easily readable by R or any other numerical software. By also zipping
the file it will be comparable in size to the binary '.mat' format.

Hans Werner



More information about the R-help mailing list