[FieldTrip] Issue with reading in .mff data
Ryan Priefer
rpriefer at adelphi.edu
Tue Mar 31 21:06:24 CEST 2020
Hello all,
I am having some further issues reading in my .mff data into fieldtrip. I
feel I am getting close but some errors still seem to pop up. The
conditions we wish to look at within our data are labeled "2bst" and "2gdv"
via E-Prime. The sampling rate is 500. I can provide more information if
need be. I will give a brief summary of what I am doing up to this point of
error:
clear all; % Remove variables from
workspace
close all; % Close all open figures
ft_defaults; % Include only necessary
subfolders
hdr = ft_read_header('/Applications/MATLAB_Plugins/AV2_AV.mff');
dat = ft_read_data('/Applications/MATLAB_Plugins/AV2_AV.mff');
event = ft_read_event('/Applications/MATLAB_Plugins/AV2_AV.mff') %Displays
some information
After completing this step, I am able to call upon the header, data, and
events with no issue. I can see my different triggers within different
events, and so on. At this point, following some walkthroughs on the
website, it seems I am also able to "segment" or look at the data with the
following code:
hdr = ft_read_header('AV2_AV.mff');
event = ft_read_event('AV2_AV.mff');
sel = [];
for i=1:length(event)
% test each event, we are looking for a trigger with value 4
if isequal(event(i).type, 'trigger') && isequal(event(i).value, '2bst')
sel = [sel; i];
end
end
sel = sel(1); % select only the first trigger that was found
begsample = event(sel(1)).sample - 0.1*hdr.Fs; % select 100ms before the
sample of the trigger
endsample = event(sel(1)).sample + 0.6*hdr.Fs; % select 600ms after the
sample of the trigger
dat = ft_read_data('AV2_AV.mff', 'begsample', begsample, 'endsample',
endsample);
I figured there would be some error here, as there is a lot going on and I
am not very skilled at this. I receive an "Index exceeds number of array
elements (0)" error.
An alternative way of doing this perhaps (provided in a script by a
colleague) is the following code:
cfg = [];
cfg.datafile = '/Applications/MATLAB_Plugins/AV2_AV.mff';
cfg.trialdef.eventtype = 'trigger'; %'?' for list
cfg.trialdef.eventvalue = {'2bst' '2gdv'};
cfg.trialdef.prestim = .1;
cfg.trialdef.poststim = .6;
cfg.trialfun = 'ft_trialfun_general';
cfg = ft_definetrial(cfg);
The error I receive here is "Error using ft_definetrial (line 196)
no trials were defined, see FT_DEFINETRIAL for help"
I am unsure what this means exactly. Prior to this, I am able to call upon
individual events and therefore I know the data is read in at least
partially. I can't seem to run anything else before ft_definetrial is
completed. Ultimately, our goal is to either process within fieldtrip to
perform a cluster-based permutation test on the data- alternatively, we
could read in an already processed file. However I believe I read averaged
.mff files cannot be read in properly? I may be wrong.
Many thanks,
--
Ryan Priefer
Lab Technical Coordinator
Communication Sciences and Disorders
t: 516.877.6787
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200331/85b9be5b/attachment.htm>
More information about the fieldtrip
mailing list