<div dir="ltr"><div><div><div><div>Hi Leila,<br><br></div>I'm not sure why it didn't work for you. I tried the following code (on a sample EDF file I found at <a href="http://www.teuniz.net/edf_bdf_testfiles/">http://www.teuniz.net/edf_bdf_testfiles/</a>) and it worked perfectly for me:<br><br><br>cfg = [];<br>cfg.dataset = 'C:\Users\Spolitzerahles\Desktop\ma0844az_1-1+.edf';<br>cfg.trl = [1 500 0];<br>cfg.continuous = 'yes';<br>data_500samples = ft_preprocessing(cfg);<br><br>cfg = [];<br>cfg.dataset = 'C:\Users\Spolitzerahles\Desktop\ma0844az_1-1+.edf';<br>cfg.trl = [1 1000 0];<br>cfg.continuous = 'yes';<br>data_1000samples = ft_preprocessing(cfg);<br><br><br><br></div>Here's the output:<br>>> data_500samples<br><br>data_500samples = <br><br> hdr: [1x1 struct]<br> label: {37x1 cell}<br> time: {[1x500 double]}<br> trial: {[37x500 double]}<br> fsample: 200<br> sampleinfo: [1 500]<br> cfg: [1x1 struct]<br><br>>> data_1000samples<br><br>data_1000samples = <br><br> hdr: [1x1 struct]<br> label: {37x1 cell}<br> time: {[1x1000 double]}<br> trial: {[37x1000 double]}<br> fsample: 200<br> sampleinfo: [1 1000]<br> cfg: [1x1 struct]<br><br><br></div>Best,<br></div>Steve<br><div><div><div><br><div><div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span><div><br><br>---<br></div>Stephen Politzer-Ahles<br>University of Oxford<br>Language and Brain Lab<br>Faculty of Linguistics, Phonetics & Philology<br><a href="http://users.ox.ac.uk/~cpgl0080/" target="_blank">http://users.ox.ac.uk/~cpgl0080/</a></span></div></div></div></div></div></div></div>
<div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
------------------------------<br>
<br>
Message: 5<br>
Date: Fri, 18 Dec 2015 13:40:59 +0000 (UTC)<br>
From: Leila Ayoubian <<a href="mailto:leilayou_54@yahoo.com">leilayou_54@yahoo.com</a>><br>
To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br>
Subject: Re: [FieldTrip] importing large edf data<br>
Message-ID:<br>
<<a href="mailto:2054001626.533069.1450446059200.JavaMail.yahoo@mail.yahoo.com">2054001626.533069.1450446059200.JavaMail.yahoo@mail.yahoo.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
?Thanks Steve for your reply.I think your code for segmenting the data is the way to go for me ! :) And I do appreciate you gave me an example.? Thanks<br>
However I tried it with two different cfg.trl = [1 1000 0]; and cfg.trl = [1 10000 0]; to see the results, and it looked the same!<br>
<br>
So this is what I get:<br>
<br>
<br>
?? hdr: [1x1 struct]<br>
???????? label: {51x1 cell}<br>
????????? time: {1x50710 cell}<br>
???????? trial: {1x50710 cell}<br>
?????? fsample: 1024<br>
??? sampleinfo: [50710x2 double]<br>
?????????? cfg: [1x1 struct]<br>
<br>
so the actual data which is in data.trial? is this in both cases!<br>
size(data.trial)<br>
<br>
ans =<br>
<br>
?????????? 1?????? 50710<br>
<br>
How could that happen if you are segmenting it in two different chunks?<br>
Best regards<br>
<br>
___________________________________________________ Leila Ayoubian<br>
<br>
<br>
<br>
From: Stephen Politzer-Ahles <<a href="mailto:stephen.politzer-ahles@ling-phil.ox.ac.uk">stephen.politzer-ahles@ling-phil.ox.ac.uk</a>><br>
To: <a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a><br>
Sent: Friday, December 18, 2015 12:37 PM<br>
Subject: Re: [FieldTrip] importing large edf data<br>
<br>
Hello Leila,<br>
<br>
I think there are a few possible options for you. If you're not interested in analyzing high frequencies, then you could import the data one sample at a time, downsampling each channel, and then concatenate the channels into one structure, as described in <a href="http://www.fieldtriptoolbox.org/faq/how_can_i_preprocess_a_dataset_that_is_too_large_to_fit_into_memory" rel="noreferrer" target="_blank">http://www.fieldtriptoolbox.org/faq/how_can_i_preprocess_a_dataset_that_is_too_large_to_fit_into_memory</a>. I don't know what your sampling rate was, but if your sampling rate was extremely high then this can save you a lot of space. For example, if you're only interested in frequencies up to high gamma (around 90-100 Hz), then your data only need to be sampled at around 250 Hz (per the Nyquist theorem, plus a little extra wiggle room), so if you sampled at e.g. 2500 Hz (which our EDF system does by default) or 5000 Hz then you have way more samples than necessary; downsampling like this will greatly reduce your array size.<br>
<br>
<br>
<br>
If that is not an option, then you can read in a segment of data as a 'trial'. ft_preprocessing understands trial start and end times from cfg.trl, which minimally is an Nx3 matrix (N is the number of trials to read, and the columns are the start sample for each trial, the end sample for each trial, and the trigger value associated with the trial; you could just put 0 if there's no trigger). So let's say you want to read the first through thousandth sample of the recording, then you would set up your cfg as normal, then add:<br>
<br>
cfg.trl = [1 1000 0];<br>
<br>
and then use ft_preprocessing.<br>
<br>
By way of example, here is code that reads in raw data as a series of 1-second "trials":<br>
<br>
cfg = [];<br>
cfg.dataset = 'C:\Users\Steve\Desktop\subj2.vhdr';<br>
cfg.trialdef.triallength = 1; % see documentation for ft_definetrial for an explanation of these parameters<br>
cfg.trialdef.ntrials = Inf;<br>
cfg = ft_definetrial( cfg );<br>
<br>
cfg.continuous = 'yes';<br>
data = ft_preprocessing(cfg);<br>
<br>
After doing whatever you need to these trials, you could concatenate them back into continuous data (see <a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2011-June/003971.html" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/pipermail/fieldtrip/2011-June/003971.html</a> for details).<br>
<br>
Best,<br>
Steve<br>
<br>
---<br>
Stephen Politzer-Ahles<br>
University of Oxford<br>
Language and Brain Lab<br>
Faculty of Linguistics, Phonetics & Philology<br>
<a href="http://users.ox.ac.uk/~cpgl0080/" rel="noreferrer" target="_blank">http://users.ox.ac.uk/~cpgl0080/</a><br>
On Fri, Dec 18, 2015 at 11:00 AM, <<a href="mailto:fieldtrip-request@science.ru.nl">fieldtrip-request@science.ru.nl</a>> wrote:<br>
<br>
Send fieldtrip mailing list submissions to<br>
? ? ? ? <a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
? ? ? ? <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
or, via email, send a message with subject or body 'help' to<br>
? ? ? ? <a href="mailto:fieldtrip-request@science.ru.nl">fieldtrip-request@science.ru.nl</a><br>
<br>
You can reach the person managing the list at<br>
? ? ? ? <a href="mailto:fieldtrip-owner@science.ru.nl">fieldtrip-owner@science.ru.nl</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of fieldtrip digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
? ?1. importing large edf data (Leila Ayoubian)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 18 Dec 2015 09:43:43 +0000 (UTC)<br>
From: Leila Ayoubian <<a href="mailto:leilayou_54@yahoo.com">leilayou_54@yahoo.com</a>><br>
To: "<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>" <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br>
Subject: [FieldTrip] importing large edf data<br>
Message-ID:<br>
? ? ? ? <<a href="mailto:807603762.476165.1450431823359.JavaMail.yahoo@mail.yahoo.com">807603762.476165.1450431823359.JavaMail.yahoo@mail.yahoo.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi:Thanks for providing us with this amazing toolbox.<br>
I am new to fieldtrip. I am trying to import EEG data in the format of *.edf for the purpose of seizure detection for epileptic patients. I can't break up the data as you understand the detection has to have continuous data. However I could load section of the data at a time and clear what is already used and reload again.?<br>
So trying to load the data like this:<br>
cfg.dataset= ('mydata.edf');<br>
rawdata=ft_preprocessing(cfg);<br>
This is the error message I get :<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
Error using zeros<br>
Requested 51x51927040 (19.7GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time<br>
and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.<br>
<br>
Error in read_edf (line 403)<br>
? dat = zeros(length(chanindx),nepochs*epochlength);<br>
<br>
Error in ft_read_data (line 622)<br>
??? dat = read_edf(filename, hdr, begsample, endsample, chanindx);<br>
<br>
Error in ft_preprocessing (line 566)<br>
????? dat = ft_read_data(cfg.datafile, 'header', hdr, 'begsample', begsample, 'endsample', endsample, 'chanindx', rawindx, 'checkboundary',<br>
????? strcmp(cfg.continuous, 'no'), 'dataformat', cfg.dataformat);<br>
<br>
Error in ReadFedfiles (line 8)<br>
rawdata=ft_preprocessing(cfg);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
I tried the ft_redefinetrial, but since the input to this file is the output from ft-PREPROCESSING it gives me the same error.<br>
<br>
<br>
I also tried to use ft_read_data to choose the samples I want to load :?filename???? = 'mydata.edf'<br>
?hdr?? = ft_read_header(filename);<br>
?sample.start=1<br>
?sample.end=100<br>
dat = ft_read_data(filename,'sample.start','1','sample.end','100')<br>
and here is again the error message:<br>
Error using zeros<br>
Requested 51x51927040 (19.7GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a<br>
long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.<br>
<br>
Error in read_edf (line 403)<br>
? dat = zeros(length(chanindx),nepochs*epochlength);<br>
<br>
Error in ft_read_data (line 622)<br>
??? dat = read_edf(filename, hdr, begsample, endsample, chanindx);<br>
<br>
Error in ReadFedfiles (line 31)<br>
dat = ft_read_data(filename,'sample.start','1','sample.end','100')<br>
?<br>
>><br>
<br>
Could you please direct me as to which functions and in which order I should be using the functions to load data in smaller samples.Some examples would be useful.<br>
Thanks again for your support and assistance.<br>
We appreciate your effort.<br>
Kind regards<br>
<br>
___________________________________________________ Dr. Leila Ayoubian<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151218/6dfa7ce1/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151218/6dfa7ce1/attachment-0001.html</a>><br>
<br>
------------------------------<br><br></blockquote></div><br></div></div></div></div></div></div></div>