<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Magda,<br>
<br>
I avoid the used of the reserved term "end" in array indexing whenever possible as I find it often results in unexpected complications. The modifications to your example that I would use are as follows...<br>
<br>
<font face="Courier New">%First half:<br>
</font>
<div><font face="Courier New">EEG = pop_select( EEG,'trial',[1:floor(EEG.trials/2)]);<br>
</font><br>
<font face="Courier New">%Second half<br>
EEG = pop_select( EEG,'trial',[floor(EEG.trials/2)+1:EEG.trials] );<br>
</font>
<div style="font-family:Tahoma; font-size:13px"><font face="Courier New"></font>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt"><font face="Courier New"></font>
<div class="PlainText"><br>
<br>
<br>
James Desjardins, MA<br>
Electrophysiology Technologist<br>
Cognitive and Affective Neuroscience Lab, Psychology Department <br>
Jack and Nora Walker Centre for Lifespan Development Research<br>
Brock University<br>
500 Glenridge Ave.<br>
St. Catharines, ON, Canada L2S 3A1<br>
905-688-5550 x4676<br>
--<br>
"'Cause you never can tell What goes on down below!<br>
"This pool might be bigger Than you or I know!"<br>
<br>
McElligot's Pool<br>
Dr.Seuss 1947</div>
</span></font></div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF987467"><font size="2" color="#000000" face="Tahoma"><b>From:</b> eeglablist-bounces@sccn.ucsd.edu [eeglablist-bounces@sccn.ucsd.edu] on behalf of Magda Gawłowska [mag.gawlowska@gmail.com]<br>
<b>Sent:</b> November-20-13 10:26 PM<br>
<b>To:</b> Arnaud Delorme<br>
<b>Cc:</b> eeglablist<br>
<b>Subject:</b> Re: [Eeglablist] Dividing datasets into halves<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Dear Arno,
<div><br>
</div>
<div>Thank you for the tip - to be honest, I'm doing it like that from the very begining, but the problem lays in determining the number of epochs I want to select, eg.:</div>
<div><br>
</div>
<div>When I use command form GUI i have to type in the range of epochs for the 1st half of dataset and for the 2nd half od dataset - like below - form 1st to 48th, - which is the 1st half of my dataset (in that case I have 98 epochs in total)</div>
<div><br>
</div>
<div>EEG = pop_select( EEG,'trial',[1:48] );<br>
</div>
<div><br>
</div>
<div>I wanted to script this step for multiple subjects and every subect has different number of epochs in dataset - so obviously I cannot leave it as [1:48].</div>
<div><br>
</div>
<div>I tried the easiest possible way to solve it, by tiping in [1:end/2] for the 1st half and [end/2:end] for the 2nd - but it doesn't work... Do you maybe have any other idea how can I specify the range of epochs? :):)</div>
<div><br>
</div>
<div>Thank you once again!</div>
<div><br>
</div>
<div>Magda</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2013/11/20 Arnaud Delorme <span dir="ltr"><<a href="mailto:arno@ucsd.edu" target="_blank">arno@ucsd.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Dear Magda,<br>
<br>
after you use the EEGLAB graphic interface to divide your dataset, look at the EEGLAB history using the "eegh" command. The last line will contain the command you will need to perform the same operation in a script.<br>
<br>
Best,<br>
<br>
Arno<br>
<div class="HOEnZb">
<div class="h5"><br>
On Nov 11, 2013, at 4:42 AM, Magda Gawłowska <<a href="mailto:mag.gawlowska@gmail.com" target="_blank">mag.gawlowska@gmail.com</a>> wrote:<br>
<br>
> Dear EEGlab Users,<br>
><br>
> I'm quite new to Matlab scripting as I was previously using only GUI version of EEGLab. I was wondering if you can help me with scripting problem. I suppose it's not very complicated, but I have a hard time with finding the solution.<br>
><br>
> So, here we go - I  have segmented datasets with different number of events in each one. I wanted to divide sets into halves and save them as the 1st and the 2nd half. Up until now I've been doing it by simply using: Eidt -> select data -> epoch range, but
 it takes ages to do it manually. Is there any way to do it using script, so that Matlab checks number of events in every dataset at first, and then takes the 1st and 2nd half separately?<br>
><br>
> I would be grateful for any help!<br>
><br>
> Greetings,<br>
><br>
><br>
> Magda<br>
><br>
</div>
</div>
<div class="HOEnZb">
<div class="h5">> _______________________________________________<br>
> Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">
http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
> To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">
eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
> For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">
eeglablist-request@sccn.ucsd.edu</a><br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Pozdrawiam!
<div><br>
</div>
<div>Magda Gawłowska</div>
</div>
</div>
</div>
</div>
</body>
</html>