Invalid MEX file /Question re: ft_clusterplot

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Sat Feb 27 14:27:09 CET 2010

Dear Andrea


On 22 Feb 2010, at 8:55, Andrea Ostendorf wrote:
> When trying to use read_mri, I encountered the error 
> "??? Invalid MEX-file
> 'D:\FieldTrip\fieldtrip-20100219\external\spm2\spm_slice_vol.dll': The
> specified procedure could not be found.
> Proceeding along the lines suggested in the FAQ - changing to the SPM2
> subdirectory and trying to compile the mex file again (using the MATLAB
> compiler) - I get a long list of error messages, starting with a complaint
> about a missing header file. I attach the complete error messages below. 

It turns out that the set of *.c files in the fieldtrip/external/spm2 directory is incomplete. You should compile the mex files from a complete spm2 version, which you can hget from the FIl website. 

> Regarding ft_clusterplot: I have got the impression that during the check
> for the existence of clusters, ft_clusterplot assumes the existence of both
> positive and negative clusters, provided that there are any at all
> (l.113-115). If there are just positive or negative clusters - as may happen
> in the case of one-sided tests - this can lead to an error such as
> ??? Reference to non-existent field 'negclusters'.
> Error in ==> ft_clusterplot at 119
>  for iNeg = 1:length(stat.negclusters)

You are right. I have made that optional on the presence of positive or negative clusters like this:

if haspos == 0 && hasneg == 0
  fprintf('%s\n','no significant clusters in data; nothing to plot')
  if haspos
    for iPos = 1:length(stat.posclusters)
      sigpos(iPos) = stat.posclusters(iPos).prob < cfg.alpha;
    if hasneg
    for iNeg = 1:length(stat.negclusters)
      signeg(iNeg) = stat.negclusters(iNeg).prob < cfg.alpha;


The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also and

More information about the fieldtrip mailing list