[Eeglablist] Scripting

Gian Marco Duma gmduma90 at gmail.com
Wed Jan 18 01:36:47 PST 2017

Dear EEGLAB users,
I'm doing a little script but I'm finding some problems.
My aim is to create a cycle to export in .txt the erpvalues of 2 bin of an
 erpset, obtained with ERPLAB,  So, I created a cycle. first of all teh
cycle load erpset. This command line works correctly. Than the cycle should
export the erpvalues of 2 bin, so I use the popfunction

pop_export2text(ERP, filename, binArray, time, timeunit, electrodes,
transpose, precision)

This function create a .txt file for each selected bin. I want to name the
.txt file with the name of the erpset. For example, if my erp set is named
*sj1 *and my bins are 17 18, I should have 2 files: sj15_17, and sj15_18,
and so on for the rest of my subjects.

This is the directory where the function should export the 2 .txt files

There are no problem to name in this way from the GUI. But I should do it
manually, and it is time consuming. if I write the commandline:

 pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\sj1)', [ 17
18], 'precision',2, 'timeunit',0.001 )
it works correctly.

This is my cycle:
cd 'C:\Users\Utente\Desktop\TO-VSTM\CHILDREN\ERP\ERP_array';
path= 'C:\Users\Utente\Desktop\TO-VSTM\CHILDREN\ERP\ERP_array';
file= dir('*.erp');

for ss=1:length(files)

  [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );

  ERP = pop_loaderp( 'filename', fname, 'filepath', path);

ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\,filename.xtx ', [ 17 18],
'precision',2, 'timeunit',0.001 );

everything works correctly except that  it creates just each run 2 file
named: fname_17, fname_18, and of course each cycle they overwrite, I have
20 subjects, and at the end I should obtain 40 .txt file but in the
txtfiles folder I have just 2 file.
what should I write in the pop_export2text function at the level of
filename, so that the cycle name each file with the name of the erpset,
exporting the file in the directory I chose?

pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\???', [ 17
18], 'precision',2, 'timeunit',0.001 );

I'm sorry, I know that the e-mail is long.
Thanks for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170118/b16b3359/attachment.html>

More information about the eeglablist mailing list