I use this for loop to export my set file to .txt.
for i = 1:length(files)
filename = files(i).name;
EEG = pop_loadset('filename', filename, 'filepath', directory_name);
EEG = eeg_checkset( EEG );
EEG = pop_export(EEG,fullfile(directory_name, [filename(1:end-4),'.txt']),'transpose','on','separator',',','precision',7);
end
But this is less my concern than the fact that the code worked well, but suddenly, it give me this error.
Reference to non-existent field 'setname'.
Error in eeg_checkset (line 689)
if ~isempty(EEG.setname)
Error in pop_loadset (line 204)
EEG = eeg_checkset(EEG);
Error in save_as_txt (line 43)
EEG = pop_loadset('filename', filename, 'filepath', directory_name);
I tried to reopen matlab, but it still gives the same error again and again.... Also when I use other scripts that start the same way, it is not working anymore.
DO you have any suggestions? Thank you very much!!
Thank you very much @Matteo V for your reply: "This just tells you that your structure EEG does not have a field named setname. In fact, I assume that in the previous line, EEG = pop_loadset(blablabla);
, EEG is empty because for some reason you fail to read the file."
I saw that in my last run I accidentally overwrote my files!! I fixed this error and it works well!! :)