reading mat-files

Christian Hesse c.hesse at FCDONDERS.RU.NL
Wed Feb 14 16:49:41 CET 2007

Hi Ulla,

> I have tried to read in a mat-file or a fif-file. Fif-file is
> having problems with coilfile acceptance and also I get
> _________________________
> ??? Invalid MEX-file 'D:\meg_pd_1.2\megmodel.dll': The specified
> module could not be found.
> -------------------------
> even when the megmodel.dll exists.

have you added the location of the DLL to the matlab path?

> I would prefare to read in my preprocessed data in mat file and
> proceed with time-frequency analysis.

Whether this will work, or not, depends on what software you use to
preprocess your data and which format you subsequently save it in.

At first glance, if you have stored your data in a mat file, then
presumably it comprises various data structures, and it is unlikely
that these will correspond to the data structures that Fieldtrip
uses. So in this situation, you would have to convert whatever is in
your mat file into FieldTrip data structures "by hand", which may or
may not be possible. If you can provide more information on the
content of your mat file, I may be able to say more.

> However I get:
> ____________________
> ??? Error using ==> fieldtrip-20061213\private\read_header
> unsupported data format
> Error in ==> read_fcdc_header at 37
> [hdr] = read_header(varargin{:});
> ---------------------
> even though mat files should be ok.
> How to give datafile and headerfile separately?
> Can datafile be in .mat or in .bin format ?
> I get "unsupported data format" from both options.
> in read_header.m :
> case 'fcdc_matbin'
>     [path, file, ext] = fileparts(filename);
>     headerfile = fullfile(path, [file '.mat']);
>     datafile   = fullfile(path, [file '.bin']);

The 'fcdc_matbin" option assumes that the data header is stored in a
mat file (in a suitable structure) and that the data itself is in a
binary file. From your description above, I gather that this is not
the format your data is in, right? You have the data in a mat file,
and this is indeed not supported in FieldTrip.

Depending on what kind of analysis you wish to do later on in
FieldTrip, e.g. source analysis or beamforming on your time-frequency
data, I would generally advise you to pre-process your data in
FieldTrip as well, as this avoids all sorts of headaches and
compatibility problems. I would therefore recommend focussing
attention on solving the problem of reading in your raw data fif file
in the first instance.

Hope this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the fieldtrip mailing list