Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: How to import a Matlab mat-file

1,129 views
Skip to first unread message

Kevin J. McCann

unread,
Feb 26, 2008, 6:49:48 AM2/26/08
to
[Normally, I do not permit this sort of post, but in this case,
it is a valid Mathematica function question, so I am permitting
it - moderator]

Kevin J. McCann wrote:
I have some data that I received from a colleague that is a rather
large mat file. "Data.mat". The file was generated with Matlab
2007b. I tried the following:

Import["Data.mat"]

Import["Data.mat","MAT"]

Import["Data.mat","mat"]

and they all give me an error:

Import::fmterr: "Cannot import data as MAT format."

Thanks,

Kevin

--

Kevin J. McCann
Research Associate Professor
JCET/Physics
Physics Building
University of Maryland, Baltimore County
1000 Hilltop Circle
Baltimore, MD 21250


John Jowett

unread,
Feb 26, 2008, 7:57:07 AM2/26/08
to
Kevin,
I had a similar problem with a simple MATLAB file in November
2007. I reported it to someone at Wolfram who confirmed that there's
a bug in MAT Import that should be fixed ...

John Jowett

mcmc...@unca.edu

unread,
Feb 27, 2008, 4:21:56 AM2/27/08
to
On Feb 26, 6:49 am, "Kevin J. McCann" wrote:
> I have some data that I received from a colleague that
> is a rather large mat file. "Data.mat". The file was
> generated with Matlab 2007b.

Mathematica 6.0.1 cannot import version 7 .mat files.
Ideally, your colleague should export the files
using the following syntax:
>> save -v6 Data.mat;

If that is not an option, you can download Octave, an
open source Matlab clone, from http://www.octave.org/.
You can then read the .mat file into Octave and save
it in the correct format via:
>> load Data.mat;
>> save -v6 Data2.mat;

Mark

Bill Rowe

unread,
Feb 27, 2008, 4:36:07 AM2/27/08
to
On 2/26/08 at 7:48 AM, Kevin....@umbc.edu (Kevin J. McCann) wrote:

>Kevin J. McCann wrote: I have some data that I received from a
>colleague that is a rather large mat file. "Data.mat". The file was
>generated with Matlab 2007b.

Per the documentation that can be found at ref/format/MAT,
Import can deal with MAT files produced by version 4 and 5 of
Matlab. Possibly this is the issue? If the default save format
of the version your colleague is using differers from what
Import expects, that would account for your difficulty.

The phrasing in the documentation for the MAT format used by
Mathematica implicitly assumes later versions of Matlab will
create either level 4 or level 5 MAT files. It does not and
cannot guarantee later versions of Matlab by default create such files.
--
To reply via email subtract one hundred and four

0 new messages