[FieldTrip] Error opening BDF file (one or more output arguments not assigned during call to “read_24bit”), following directory reorganisation.
Oscar Anderson
ota277 at student.bham.ac.uk
Sun Aug 6 16:30:23 CEST 2023
Hi there.
I am a masters student, new to FieldTrip, currently using the toolbox for the first time to undertake preprocessing, ICA, artifact rejection and statistical analysis of EEG data. I recently reached the end of my pipeline – successfully performing each of these stages and producing results from my analysis – when I decided to go back and re-try the process again, to try to make further improvements now that I had gotten some successful practice.
After my first successful run of the pipeline, the files and folders that I had been calling in the script weren’t ideally organised, so I reorganised/tidied the folders and files in the MatLab working directory that I had been using, and made sure to update the paths being called in the pipeline script. It is worth noting here that nothing else in the original pipeline script was yet changed and nothing was removed from any of the original working directory – files and folders were just re-organised into more relevant folders and sub-folders.
Now, when trying to run the very first preprocessing stage of my pipeline again – defining the trials from the events in my raw BDF data with ft_definetrial, I get an error.
Here is the code that I am trying to run:
>> cfg = [];
cfg.dataset = 'al001.bdf'; % Initialise Biosemi Data File.
%% Baseline correct.
cfg.preproc.demean = 'yes'; % Subtract window mean from each point.
cfg.baselinewindow = [-0.2 0]; % Use window recommended by Steven Luck.
%% De-trend.
cfg.detrend = 'yes'; % Remove baseline drift.
%% Band-pass filter.
cfg.bpfilter = 'yes';
cfg.bpfreq = [0.1 30]; % Use range specified.
cfg.bpfilttype = 'fir'; % Use FIR filter.
%% Notch (band-stop) filter.
cfg.bsfreq = [7 8]; % Remove SSVEP of 7.52Hz.
%% Re-reference.
cfg.reref = 'yes';
cfg.refmethod = 'avg'; % Use average.
cfg.channel = {'Fp1', 'AF3', 'F7', 'F3', 'FC1', 'FC5', 'T7', 'C3', 'CP1', 'CP5', 'P7', 'P3', 'Pz', 'PO3', 'O1', 'Oz', 'O2', 'Po4', 'P4', 'P8', 'CP6', 'CP2', 'C4', 'T8', 'FC6', 'FC2', 'F4', 'F8', 'AF4', 'Fp2', 'Fz', 'Cz', 'A1', 'A2', 'LEOG', 'REOG', 'UEOG', 'DEOG', 'EXG7', 'EXG8'};
cfg.refchannel = {'T7', 'T8'}; % Use average of mastoids.
%% Segment.
cfg.trialdef.eventtype = 'STATUS'; % Events are marked as type 'STATUS'.
cfg.trialdef.eventvalue = 111:170; % Select these events of interest.
cfg.trialdef.prestim = 0.5; % Specify time before events to include.
cfg.trialdef.poststim = 1.5; % Specify time after events to include.
cfg = ft_definetrial(cfg); % Define trials in data to segment into.
trials = cfg.trl; % Save trials definition as variable.
%% Apply pre-processing.
data = ft_preprocessing(cfg);
Here is the error that I am receiving:
evaluating trial function 'ft_trialfun_general'
reading the header from 'al001.bdf'
reading the events from 'al001.bdf'
error opening file: al001.bdf
One or more output arguments not assigned during
call to "read_24bit".
Error in read_biosemi_bdf>readLowLevel (line 283)
buf = read_24bit(filename, offset, numwords);
Error in read_biosemi_bdf (line 254)
buf = readLowLevel(filename, offset, epochlength); % see below in subfunction
Error in ft_read_data (line 430)
dat = read_biosemi_bdf(filename, hdr, begsample, endsample, chanindx);
Error in ft_read_event (line 416)
sdata = ft_read_data(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', begsample, 'endsample', endsample, 'chanindx', schan);
Error in ft_trialfun_general (line 116)
event = ft_read_event(cfg.headerfile, eventopt{:});
Error in ft_definetrial (line 198)
[trl, event] = feval(cfg.trialfun, cfg);
Given that the paths are all being called correctly, and this same code that I am using was successful in reading these same files, earlier, in the successful run of the pipeline, I cannot explain why this error in reading the events is occurring. Is there any way that the reorganisation of the MatLab path could have created an issue with the BDF events being read? Or is there another explanation for this error, given that the issue must not reside within the previously successful code or data files, themselves?
I’d really appreciate any insight that the FieldTrip community can provide.
Thanks.
Oscar Anderson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230806/798172e7/attachment.htm>
More information about the fieldtrip
mailing list