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

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Tue Mar 16 18:14:02 CET 2021


Hi Merethe,

Welcome to Fieldtrip!

ft_read_event is what we call a 'low-level' function in fieldtrip, and is
typically not called in an analysis script (as a beginner at least).
Instead, we advise using 'higher-level' functions that call those (e.g.
ft_preprocessing) and use a more curated cfg structure for configuration
options etc.

Have you already run through one or two of the tutorials
<https://www.fieldtriptoolbox.org/tutorial/>? That would be a good way to
get introduced to a standard workflow.

If you are already beyond this, and need more specific help with
ft_read_event, e.g. if you are creating your own trialfun, then we would
need a bit more info to help out. If it indeed concerns your own trialfun,
then posting the rest of the code (which should not be too large to begin
with) would be a good start.

Good luck!
Stephen








Op di 16 mrt. 2021 om 17:35 schreef Merethe Blandhol <
merethe.blandhol at new.ox.ac.uk>:

> 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
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210316/c75f3505/attachment.htm>


More information about the fieldtrip mailing list