Hi everyone,
I am trying to read a file that is something like Data Sampling Rate: 256 Hz ***********************
Channels in EDF Files: ******************** Channel 1: FP1-F7 Channel 2: F7-T7 Channel 3: T7-P7 Channel 4: P7-O1
File Name: chb01_02.edf
File Start Time: 12:42:57
File End Time: 13:42:57
Number of Seizures in File: 0
File Name: chb01_03.edf
File Start Time: 13:43:04
File End Time: 14:43:04
Number of Seizures in File: 1
Seizure Start Time: 2996 seconds
Seizure End Time: 3036 seconds
so far i have:
fid1= fopen('chb01-summary.txt') data=struct('id',{},'stime',{},'etime',{},'seizenum',{},'sseize',{},'eseize',{}); if fid1 ==-1 error('File cannot be opened ') end tline= fgetl(fid1); while ischar(tline) i=1; disp(tline);
I want to use regexp to find the expressions and so far have
line1= '(.*\d{2} (\.edf)' data{1} = regexp(tline, line1); tline=fgetl(fid1); time = '^Time: .*\d{2]}: \d{2} :\d{2}' ; data{2}= regexp(tline,time); tline=getl(fid1); seizure = '^File: .*\d'; data{4}= regexp(tline,seizure); if data{4}>0 stime = '^Time: .*\d{5}'; tline=getl(fid1); data{5}= regexp(tline,seizure); tline= getl(fid1); data{6}= regexp(tline,seizure); end
And I tried using a loop to find the line at which file name starts with if true for (firstline<1) (firstline>1 ) firstline= strfind(tline, 'File Name') tline=fgetl(fid1); end end
and then I am stumped. say I am at the line at which the information is there, how do i store the information with regexp? i got data= [] [] after running the code once…
Thanks in advance..
Best Answer