Issue with edfread - "The input, '2021-06-0​4T15:42:31​.188466-04​:00', did not match any of the valid values."

6 views (last 30 days)
Hi,
I'm trying to read an EDF file from an Emotiv EPOC, but I keep getting the same error when I try to use edfread. I have tried renaming the edf file so it didn't have the date in the title, but that didn't help (so I had the name as 'Event_Marker_Try_4_EPOCX.edf'). I still got this same error. I need to use the EDF format because that gives an accurate timestamp (vs the CSV file). Does anyone know how I can fix this issue?
Thank You!

Accepted Answer

Walter Roberson
Walter Roberson on 10 Jul 2021
Positions 193 to 236 of the file must be 'EDF+C' or 'EDF+D' or blank, but instead it is that particular time.
The program does not believe that your file is a valid EDF or EDF+ file.
  9 Comments
Walter Roberson
Walter Roberson on 11 Jul 2021
The edf file is not compliant with EDF or EDF+ . In particular, the "reserved" field must be:
‘reserved’: empty for EDF; ‘EDF+C’ for continuous recording; ‘EDF+D’ if the recording is interrupted.
However, instead it is a time specification.

Sign in to comment.

More Answers (1)

Christina Diersing
Christina Diersing on 11 Jul 2021
So, I've attached a zip file with my code and the csv file I used. I had to copy the timestamp and sensor data into a new excel document to make it so Matlab could import it. In excel, I selected all of the numbers, right clicked, selected 'Format Cells', under 'category' I selected 'number' and I changed the decimal places to '6'. (I'm not sure if that affected the data being imported to Matlab or not, but I prefer seeing the number with decimal places).
Here is a copy of the code if you don't want to download the zip file:
%%Importing_data_from_csv_to_Matlab
%add paths and change current directory to the correct folders
addpath 'C:\Users\chris\Documents\College\Sixth Year\DAGSI\Data\EMOTIV Recordings\Event Marker Try 4'
cd 'C:\Users\chris\Documents\College\Sixth Year\DAGSI\Data\EMOTIV Recordings'
format long; %this stops Matlab from rounding the timestamps and data
T=readtable('Try 4.csv'); %reads the csv file into Matlab and assigns the data to variable/table T
%Lines 8-16 Assign variables to the EEG data for each electrode
timestamp=T.Timestamp-1622835751.18846; %this makes timestamp 0 at the start of the recording
T.Timestamp=T.Timestamp-1622835751.18846; %This changes the official Timestamp column so it is 0 at the start of the recording
AF3=T.EEG_AF3; F7=T.EEG_F7;
F3=T.EEG_F3; FC5=T.EEG_FC5;
T7=T.EEG_T7; P7=T.EEG_P7;
O1=T.EEG_O1; O2=T.EEG_O2;
P8=T.EEG_P8; T8=T.EEG_T8;
FC6=T.EEG_FC6; F4=T.EEG_F4;
F8=T.EEG_F8; AF4=T.EEG_AF4;
%Line 18 just shows that it correctly imported the data
T5=head(T, 5) %shows first 5 rows of table T
% Plot all electrode readings on the same plot (vs timestamp)
plot(timestamp, AF3);
hold on;
plot(timestamp, F7);
plot(timestamp, F3); plot(timestamp, FC5);
plot(timestamp, T7); plot(timestamp, P7);
plot(timestamp, O1); plot(timestamp, O2);
plot(timestamp, P8); plot(timestamp, T8);
plot(timestamp, FC6); plot(timestamp, F4);
plot(timestamp, F8); plot(timestamp, AF4);
%Label plot
legend('AF3', 'F7', 'F3', 'FC5', 'T7', 'P7', 'O1', 'O2', 'P8', 'T8', 'FC6', 'F4', 'F8', 'AF4');
title('Try 4 EEG Test');
xlabel('Timestamp (s)');
ylabel('EEG Value (uV)');
I hope this helps!
  1 Comment
Walter Roberson
Walter Roberson on 11 Jul 2021
T = readtable('Try 4.csv');
T.dt = datetime(T.Timestamp,'convertfrom', 'posixtime','format', 'dd-MMM-yyyy HH:mm:ss.SSSSSS');
timestamp = T.dt - T.dt(1);
AF3=T.EEG_AF3; F7=T.EEG_F7;
F3=T.EEG_F3; FC5=T.EEG_FC5;
T7=T.EEG_T7; P7=T.EEG_P7;
O1=T.EEG_O1; O2=T.EEG_O2;
P8=T.EEG_P8; T8=T.EEG_T8;
FC6=T.EEG_FC6; F4=T.EEG_F4;
F8=T.EEG_F8; AF4=T.EEG_AF4;
plot(timetamp, [AF3, F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8, AF4]);
legend({'AF3', 'F7', 'F3', 'FC5', 'T7', 'P7', 'O1', 'O2', 'P8', 'T8', 'FC6', 'F4', 'F8', 'AF4'});
xlabel('Timestamp (s)');
ylabel('EEG Value (uV)');

Sign in to comment.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!