[FieldTrip] Error with ft_read_event - installation/path problem?

Merethe Blandhol merethe.blandhol at new.ox.ac.uk
Tue Mar 16 17:20:36 CET 2021


Hi everyone,
I'm a master's student, new to the Fieldtrip community - I'm currently working on analyzing data for my research project involving an MEG sustained attention button-press task.

When trying to run a script that gets stimulus onset and button press timings for each participant, I encounter an error at the first line with the fieldtrip function ft_read_event. Could this be an error in my fieldtrip path or installation?

I have already tried basic troubleshooting for the fieldtrip path, but this doesn't seem to solve it. The script is running fine for others, so it seems to be an issue with my computer/FieldTrip specifically.

The line of code is:

evt = ft_read_event(fullfile(myDir, fileID));

I get the following error message:

Reading 6000 ... 174999  =     12.000 ...   349.998 secs...Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that
dimension.

Error in fiff_read_raw_segment (line 161)
                    one = double(reshape(tag.data,nchan,this.nsamp));

Error in ft_read_data (line 1251)
      dat = fiff_read_raw_segment(hdr.orig.raw,begsample+hdr.orig.raw.first_samp-1,endsample+hdr.orig.raw.first_samp-1,chanindx);

Error in read_trigger (line 82)
  dat = ft_read_data(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', begsample, 'endsample', endsample, 'chanindx',
  chanindx, 'checkboundary', 0);

Error in ft_read_event (line 1637)
        trigger = read_trigger(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', flt_minsample, 'endsample',
        flt_maxsample, 'chanindx', binaryindx, 'detectflank', detectflank, 'denoise', denoise, 'trigshift', trigshift, 'trigpadding',
        trigpadding, 'fixneuromag', false);

Error in getButtonPresses (line 21)
evt   = ft_read_event(fullfile(myDir,fileID));

I thought this might be an error with my fieldtrip path, and I have tried restoring the default path like this:
>> restoredefaultpath
>> addpath('C: (location of fieldtrip)')
>> ft_defaults

However, the problem is not resolved after this.

I also looked at each function using >> which ft_read_event etc.
It returns a similar location for each function (C:/Admin/AppData/Roaming/MathWorks/MATLAB Add-Ons/Collections/FieldTrip/fileio/ft_read_event.m) but read_trigger is not found.

My MATLAB is located on the computer under "Program Files" in case this is relevant.

Matlab version: 9.8.0.1380330 (R2020a) Update 2
OS build: 19042.804/Windows 10

Any help or advice is greatly appreciated!

Kind Regards,
Merethe Blandhol


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210316/ce3474c2/attachment.htm>


More information about the fieldtrip mailing list