<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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 Muhammad,<br>
<br>
I have a "batch_context" extension for EEGLab available at github here: <a href="https://github.com/jadesjardins/batch_context." target="_blank">
https://github.com/jadesjardins/batch_context.</a><br>
<br>
I have posted an example of its use on youtube here: <a href="https://www.youtube.com/watch?v=KKuX-k5hF1A." target="_blank">
https://www.youtube.com/watch?v=KKuX-k5hF1A.</a> The demo closely resembles what you are trying to achieve, except in the case of the demo the input files are *.bdf.<br>
<br>
I am not familiar with the <span dir="ltr">pop_read_gtec function but I expect that it can accept a file name as a input and then output the EEG structure. This is important for it to be compatible with uninterrupted batch processing. I expect that you could
 call the function as follows:<br>
<br>
<font face="Courier New">EEG=pop_read_gtec(EEG,'</font></span><span dir="ltr"><font face="Courier New">C:\\Users\\Documents\\MATLABfiles\\EEG_Data\\Test\\myfile_1_raw.mat');<br>
</font><br>
... or something like that, depending on what it expects as the file name input...<br>
<br>
You can use the "Download ZIP" button at the github repository then extract the folder to your "plugins" folder within the EEGLab folder structure.<br>
<br>
To execute a history template batching script follow the example in the demo video.<br>
<br>
If my guess about <font face="Courier New">pop_read_gtec <font face="Tahoma">file name input is correct your *.htb script should be as follows:<br>
<br>
<br>
<br>
</font></font></span><span dir="ltr">
<div><font face="Courier New">EEG=pop_read_gtec(EEG,'[batch_dfp]\\[batch_dfn]);</font></div>
<font face="Courier New"></font>
<div><font face="Courier New">EEG = eeg_checkset( EEG );</font></div>
<font face="Courier New"></font>
<div><font face="Courier New">EEG = pop_chanevent(EEG, 65,'edge','leading','edgelen',0);</font></div>
<font face="Courier New"></font>
<div><font face="Courier New">EEG = eeg_checkset( EEG );</font></div>
<font face="Courier New"></font>
<div><font face="Courier New">EEG = pop_saveset( EEG, 'filename','[batch_dfn,.,-1].set','filepath','C:\\Users\\Documents\\MATLABfiles\\EEG_Data\\Test\\');</font></div>
<font face="Courier New"></font>
<div><font face="Courier New">EEG = eeg_checkset( EEG ); </font></div>
<font face="Courier New"></font>
<div><br>
<br>
<br>
Assuming that your input file names are something like <font face="Tahoma" color="black" size="2">
<span style="font-size:10pt;" dir="ltr">S###_Oddball.mat, if you copy the above script to a text file and name it *.htb and then execute it on all of your *.mat files (like in the demo) it will generate new *.set & *.fdt pairs (assuming your eeglab settings)
 that simply replace the extensions of the input file names and places them in </span>
</font><font face="Tahoma" color="black" size="2"><span style="font-size:10pt;" dir="ltr"><span dir="ltr"><font face="Courier New">'C:\\Users\\Documents\\MATLABfiles\\EEG_Data\\Test\\'</font></span>.<br>
<br>
If you try this and run into problems don't hesitate to contact me directly to help troubleshoot.<br>
<br>
The batch_context script execution will not hesitate to overwrite files, so of course, always work on backed up copies.<br>
</span></font></div>
</span><br>
<div>I hope this is helpful.<br>
<br>
<br>
<div style="font-family:Tahoma; font-size:13px">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText">James Desjardins, MA<br>
<i>Electrophysiology Technologist</i><br>
Cognitive and Affective Neuroscience Lab, Psychology Department <br>
Jack and Nora Walker Centre for Lifespan Development Research<br>
<i>High Performance Computing Consultant</i><br>
SHARCNet, Compute/Calcul Canada<br>
<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="divRpF301332"><font face="Tahoma" color="#000000" size="2"><b>From:</b> eeglablist-bounces@sccn.ucsd.edu [eeglablist-bounces@sccn.ucsd.edu] on behalf of Muhammad Adeel Parvaz [mparvaz@gmail.com]<br>
<b>Sent:</b> January-01-15 11:11 PM<br>
<b>To:</b> eeglablist@sccn.ucsd.edu<br>
<b>Subject:</b> [Eeglablist] script for importing .mat files<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am new to EEGLAB. I have an EEG data (.mat) that I can successfully import it in EEGLAB, use the last channel (#65) to load events and then save the data as a .set and .fdt pair. However, I have about 80 of these files and I would like to repeat these
 3 processes to each of these files. I looked into doing it through GUI on the first file and then using the dataset history to get the commands for each step and applying to other files, but I am not quite sure how to do that.</div>
<div><br>
</div>
<div>By the way, I can manually import a bunch of files and then run the history commands to automatically perform the other two steps. So, the automatic import seems to be the limiting factor. I would ideally like the script to run through the directory and
 perform these steps on each file.</div>
<div><br>
</div>
<div>My command history for one dataset looks like this:</div>
<div><br>
</div>
<div>pop_read_gtec(ALLEEG) % importing function supplied by the vendor</div>
<div>EEG = eeg_checkset( EEG );</div>
<div>EEG = pop_chanevent(EEG, 65,'edge','leading','edgelen',0);</div>
<div>EEG = eeg_checkset( EEG );</div>
<div>EEG = pop_saveset( EEG, 'filename','S001_Oddball.set','filepath','C:\\Users\\Documents\\MATLABfiles\\EEG_Data\\Test\\');</div>
<div>EEG = eeg_checkset( EEG ); </div>
<div><br>
</div>
<div>Any and every help would be much appreciated.</div>
<div><br>
</div>
<div>Thanks and a happy new year!</div>
<div><br>
</div>
<div>-Muhammad </div>
</div>
</div>
</div>
</div>
</body>
</html>