[FieldTrip] importing large edf data
Leila Ayoubian
leilayou_54 at yahoo.com
Tue May 3 15:34:14 CEST 2016
Hi,I am trying to concatenate two EDF files in Matlab and convert it back to EDF. (basically sticking the original data to on piece)Here is my code. It does create the 'a' file but it does not open as EDF.Any suggestion?
clc;clear all;close all;%%[fileName1, pathName1] = uigetfile({'*.edf;*.e', 'Nicolete files (*.edf;*.e)'; '*.*', 'All files (*.*)'}, 'Select edf file');file1 = fullfile(pathName1, fileName1);cfg1 = [];%cfg.trl = [1 1000 0];%45min*60=2700 sec % 2700sec*1000=2700000 mscfg1.trialdef.triallength = 5;cfg1.dataset =file1; %'For leila.edf';cfg1= ft_definetrial( cfg1 );cfg1.continuous = 'yes';datastr1 = ft_preprocessing(cfg1);data1=datastr1.trial{1,1};
Fs=datastr1.fsample;
hdr=datastr1.hdr;%%
[fileName2, pathName2] = uigetfile({'*.edf;*.e', 'Nicolete files (*.edf;*.e)'; '*.*', 'All files (*.*)'}, 'Select edf file');file2 = fullfile(pathName2, fileName2);cfg2 = [];%cfg.trl = [1 1000 0];%45min*60=2700 sec % 2700sec*1000=2700000 mscfg2.trialdef.triallength = 5;cfg2.dataset =file2; %'For leila.edf';cfg2= ft_definetrial( cfg2 );cfg2.continuous = 'yes';datastr2 = ft_preprocessing(cfg2);
data2=datastr2.trial{1,1};
Fs2=datastr2.fsample;
% EEG=cat(2,data1,data2)% EEG=EEG';% HDR=hdr1% out=EDFCreator(EEG);
dat = cat(2,data1,data2);%%% write_edf('a', hdr, dat);
ft_write_data('a', dat, 'header', hdr,'dataformat','edf' ) __________________________________________________ Leila Ayoubian, PhD.
Institute of Psychiatry, Psychology and Neuroscience
King's College London
From: Stephen Politzer-Ahles <stephen.politzer-ahles at ling-phil.ox.ac.uk>
To: fieldtrip at science.ru.nl
Sent: Wednesday, February 10, 2016 11:20 AM
Subject: Re: [FieldTrip] importing large edf data
Hi Leila (and Arjen):
I just tried this out with a sample file, it looks like you can get this information if you use ft_read_header() rather than ft_preprocessing. The cfg structure I got from ft_preprocessing didn't contain the time-of-day information, but the structure returned from ft_read_header did:
>> hdr = ft_read_header( cfg.dataset ); hdr.orig.T0
ans =
2005 9 15 10 18 42
I assume that's showing year, month, day, hour, minute (presumably based on the clock of the computer that made the recording).
Best,
Steve
---
Stephen Politzer-Ahles
University of Oxford
Language and Brain Lab
Faculty of Linguistics, Phonetics & Philology
http://users.ox.ac.uk/~cpgl0080/
Message: 3
Date: Tue, 9 Feb 2016 15:40:35 +0000 (UTC)
From: Leila Ayoubian <leilayou_54 at yahoo.com>
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] importing large edf data
Message-ID:
<1722640118.1244946.1455032435939.JavaMail.yahoo at mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"
Thanks.I need to retrieve the time when the recordings occure and I don't see it. I get the Fs but no more.I am using this code :
cfg = [];cfg.trl = [1 1000000 0];%cfg.trl = [100001 2000000 0];%cfg.trialdef.triallength = 5;cfg.dataset =fileName; %'For leila.edf';cfg= ft_definetrial( cfg );cfg.continuous = 'yes';
datastr = ft_preprocessing(cfg);data=datastr.trial{1,1};chanls=datastr.label;Fs=datastr.fsample;
and getting this?datastr =?
? ? ? ? ? ?hdr: [1x1 struct]? ? ? ? ?label: {65x1 cell}? ? ? ? ? time: {[1x1000000 double]}? ? ? ? ?trial: {[65x1000000 double]}? ? ? ?fsample: 1024? ? sampleinfo: [1 1000000]? ? ? ? ? ?cfg: [1x1 struct]
cfg =?
? ? ? ? ? ? ? ? ? trl: [1 1000000 0]? ? ? ? ? ? ? dataset: 'Event13_Seizure_triggered_by_cortical_stim_Segment_1.edf'? ? ? ? ? trackconfig: 'off'? ? ? ? ? checkconfig: 'loose'? ? ? ? ? ? checksize: 100000? ? ? ? ?showcallinfo: 'yes'? ? ? ? ? ? ? ? debug: 'no'? ? outputfilepresent: 'overwrite'? ? ? ? trackcallinfo: 'yes'? ? ? ? trackdatainfo: 'no'? ? ? ? ? ? ?callinfo: [1x1 struct]? ? ? ? ? ? ? version: [1x1 struct]? ? ? ? ? ? ?datafile: 'Event13_Seizure_triggered_by_cortical_stim_Segment_1.edf'? ? ? ? ? ?headerfile: 'Event13_Seizure_triggered_by_cortical_stim_Segment_1.edf'? ? ? ? ? ?dataformat: 'edf'? ? ? ? ?headerformat: 'edf'? ? ? ? ? ? ? ? event: []? ? ? ? ? ?continuous: 'yes'
?__________________________________________________ Leila Ayoubian, PhD.
Institute of Psychiatry, Psychology and Neuroscience
King's College London
From: Arjen Stolk <a.stolk8 at gmail.com>
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Sent: Tuesday, February 9, 2016 3:32 PM
Subject: Re: [FieldTrip] importing large edf data
Hi both,There might be information on the date and time of recording in the orig field of the header, if that's what you're looking for. Don't know the name of the subfield from the top of my head.Arjen
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160503/c784ec9e/attachment-0001.html>
More information about the fieldtrip
mailing list