importing 306-Vectorview dataset

Lauri Parkkonen lauri at NEURO.HUT.FI
Mon Aug 15 21:43:58 CEST 2005

Hi Daniel and other Fieldtrippers,

To read the Neuromag files into Fieldtrip/Matlab you need Kimmo Uutela's
FiffAccess (aka meg-pd) package, available for Linux, HPUX and Windows
as Robert and Jon pointed out. The packages do contain the required
shared library, however, you need to tell the Linux dynamic linker where
to find this library before starting Matlab (see the FiffAccess
manual/Installation instructions). This step is often forgotten so I
wrote here some instructions (assuming you're running Linux).

You have two options to tell the system where to look for the new library:

1) User-specific configuration:
    Set the environment variable LD_LIBRARY_PATH to point to the library
directory before starting Matlab:
    - sh/bash users
        export LD_LIBRARY_PATH /opt/neuromag/lib/i586-pc-linux-gnu
    - tcsh/csh users
       setenv LD_LIBRARY_PATH /opt/neuromag/lib/i586-pc-linux-gnu

    (there are some inconsistencies whether the architecture is i586-...
or i686-...; please check in which one you actually find the library
file after installing the FiffAccess package and substitute accordingly)

2) System-wide configuration:
    As the root user, add the line /opt/neuromag/lib/i586-pc-linux-gnu
to /etc/ (or - in some Linux distros - make a file containing
that line and put the file under /etc/ and run /sbin/ldconfig.

With both options, you can check if the shared lib is found correctly by

    ldd /opt/neuromag/meg_pd_1.2/megmodel.mexglx

which should print out something like: =>  (0x00d02000) =>
/opt/neuromag/lib/i586-pc-linux-gnu/ (0x00beb000) => not found => not found => not found => /lib/ (0x0051e000) => /lib/ (0x003ba000)
        /lib/ (0x0027b000)

Don't worry about libmx, libmex and libmat not being found; they'll be
linked correctly by Matlab.

Hope this helps you to get the Neuromag file import working.

Best regards,

Robert Oostenveld wrote:

> Hi Daniel,
> Did you download and install the MEG-PD toolbox (see http://
> You might also need an
> extra shared library that is missing in the meg-pd tgz file, see
> Fieldtrip does not support the Neuromag *.fif file format natively,
> since it is a closed file format. However, Fieldtrip can use the MEG-
> PD toolbox. What is does is to call the appropriate functions from
> the MEG-PD toolbox, and to reformat their output into a format that
> all Fieldtrip functions can handle. The "megmodel" function is a
> function from the MEG-PD toolbox. This MEG-PD toolbox contains mex
> files, and they are only provided for linux and HPUX. That means that
> you cannot read Neuromag data in Matlab under Windows. Besides the
> mex files (i.e. a file named megmodel.mexglx), there are
> documentation files (i.e. megmodel.m). These documentation files
> contain only help and cannot be executed. I suspect that the mex file
> is missing in your installation. Please type "which megmodel" and
> check whether it is the mexglx or the m file.
> best regards
> Robert
> On 14-aug-2005, at 14:25, Daniel Kislyuk wrote:
>> Hello!
>> I'm trying to import neuromag data (with EEG) to fieldtrip using
>> read_fcdc_header and read_fcdc_data routines, but i keep getting these
>> error message:
>> ----------------------------------------------------------------------
>> ------------
>> ??? Attempt to execute SCRIPT megmodel as a function.
>> Error in ==> d:\danielk\fieldtrip\private\fif2grad.m
>> On line 19  ==> megmodel('head',[0 0 0],filename);
>> Error in ==> d:\danielk\fieldtrip\read_fcdc_header.m
>> On line 245  ==>   hdr.grad = fif2grad(headerfile);
>> ----------------------------------------------------------------------
>> -------------
>> Could you, please, help me?
>> Thanks,
>> Daniel
> =======================================================
> Robert Oostenveld, PhD
> F.C. Donders Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> phone: +31-24-3619695

Lauri Parkkonen
Brain Research Unit, Low Temperature Laboratory
Helsinki University of Technology
Otakaari 3 A, 02150 ESPOO, FINLAND
tel: +358-9-4512965
fax: +358-9-4512969
mailto:lauri at

More information about the fieldtrip mailing list