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 -- Prof Leslie Smith Computing Science and Maths University of Stirling FK9 4LA Scotland Tel (44) 1786 467435 -- The University of Stirling is a university established i...{{dropped:11}}
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
Hi. On 11/17/07, Prof Leslie Smith <lss at cs.stir.ac.uk> wrote:> 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)).See help(readMat), which says "From Matlab v7, _compressed_ MAT version 5 files are used by default [3]. These are not supported. Use 'save -V6' in Matlab to write a MAT file compatible with Matlab v6, that is, to write a non-compressed MAT version 5 file. Note: Do not mix up version numbers for the Matlab software and the Matlab file formats." This should do if you have access to Matlab and you're in charge of the MAT files. Hope this helps Henrik> > 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 > > -- > Prof Leslie Smith > Computing Science and Maths > University of Stirling FK9 4LA > Scotland > Tel (44) 1786 467435 > > -- > The University of Stirling is a university established i...{{dropped:11}} > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
According to the Octave manual (page 146 of Edition 3 for Octave version 2.9.16) Octave can read Matlab version 7 files. It can also output with similar options to Matlab. As there are no issues or licencing problems when running Octave and R on the one machine. Note that there is a new native Windows version of Octave now available that does not require cygwin. Best Reards John On 17/11/2007, Prof Leslie Smith <lss at cs.stir.ac.uk> wrote:> 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 > > -- > Prof Leslie Smith > Computing Science and Maths > University of Stirling FK9 4LA > Scotland > Tel (44) 1786 467435 > > -- > The University of Stirling is a university established i...{{dropped:11}} > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- John C Frain Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:frainj at tcd.ie mailto:frainj at gmail.com