EEGLAB Import .vhdr (bva) files and save as .set in a loop

36 次查看(过去 30 天)
Hello,
first of all, I'm a beginner in coding so please forgive my bad style. Some of the code may be just copied from the GUI.
I am trying to load EEG files in.vhdr (Brain Vision) format and save them as individual .set files using EEGLAB.
I'm also trying to use a loop.
This is my code now:
%%
allmyfiles = dir('*.vhdr');
allmyfilenames = string({allmyfiles.name})';
newsetnames = [ "name1.set" "name2.set" ];
for n = 1:size(allmyfilenames,1)
bvsetName = allmyfiles(n).name;
newsetname = newsetnames(n);
EEG = pop_loadbv('c:mypath1', bvsetName, [], [] );
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0,'gui','off');
EEG = eeg_checkset( EEG );
EEG = pop_saveset( EEG, 'filename',newsetname,'filepath','c:mypath2');
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
EEG = pop_delset( EEG, [1] );
STUDY = []; CURRENTSTUDY = 0; ALLEEG = []; EEG=[]; CURRENTSET=[];
end
%%
The newsetname variable is a string variable, but I keep getting this error and I can't solve it.
Error using pop_saveset (line 117)
error: argument 'filename' must be a string
Thank you very much to those who will try to help me.
  3 个评论

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by