[Eeglablist] Scripting

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Tue Jan 24 12:14:00 PST 2017

Dear Gian,

I have never been an ERPLAB user, so I could be wrong.
There are two possibilities.
1. length(files) == 2 by mistake
2. There are only two file names available to save data
Check which one is the case by using Matlab debug mode.


On Wed, Jan 18, 2017 at 1:36 AM, Gian Marco Duma <gmduma90 at gmail.com> wrote:

> 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
> 'C:\Users\Utente\Desktop\TO-VSTM\prova'
> 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');
> files={file(:).name}'
> for ss=1:length(files)
>    fname=char(files(ss));
>   [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );
>   ERP = pop_loaderp( 'filename', fname, 'filepath', path);
>  pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\,filename.xtx
> ', [ 17 18], 'precision',2, 'timeunit',0.001 );
> end
> 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
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.
> ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu

Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170124/8190549b/attachment.html>

More information about the eeglablist mailing list