<div dir="ltr">Dear EEGLAB users,<div>I'm doing a little script but I'm finding some problems. </div><div>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 </div><div><div><br></div><div>pop_export2text(ERP, filename, binArray, time, timeunit, electrodes, transpose, precision)<br></div><div><br></div><div>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 <b>sj1 </b>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.</div><div><br></div><div><div>This is the directory where the function should export the 2 .txt files</div><div>'C:\Users\Utente\Desktop\TO-VSTM\prova'<br></div></div><div><br></div><div>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:</div><div><br></div><div> pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\sj1)', [ 17 18], 'precision',2, 'timeunit',0.001 )<br></div><div>it works correctly.<br></div></div><div><br></div><div><br></div><div>This is my cycle:</div><div><div><div>cd 'C:\Users\Utente\Desktop\TO-VSTM\CHILDREN\ERP\ERP_array';</div><div>path= 'C:\Users\Utente\Desktop\TO-VSTM\CHILDREN\ERP\ERP_array';</div><div>file= dir('*.erp');</div><div>files={file(:).name}'</div></div><div><br></div><div><div>for ss=1:length(files)</div><div>   fname=char(files(ss));</div><div> </div><div>  [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );</div><div>  </div><div>  ERP = pop_loaderp( 'filename', fname, 'filepath', path);</div><div> </div><div> pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\,filename.xtx ', [ 17 18], 'precision',2, 'timeunit',0.001 );</div><div>end</div></div><div><br></div><div>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. </div></div><div>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?</div><div><br></div><div><div>pop_export2text( ERP,'C:\Users\Utente\Desktop\TO-VSTM\txtfiles\???', [ 17 18], 'precision',2, 'timeunit',0.001 );</div><div><br></div></div><div>I'm sorry, I know that the e-mail is long.</div><div>Thanks for your help</div><div><br></div></div>