将eeglab保存到for循环Matlab中的mat文件

我想在一个循环中将set文件保存在.mat文件中,保持原始文件名不变,只是将扩展名改为.mat。

我尝试了我在网上找到的不同的编码方法,但我从来没有让它改变每个主题的文件名。我可以使用下面的代码将set文件导出为.txt文件,而不会出现任何问题。难道没有一种方法可以在.mat中导出吗?

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),'.mat']));
  
end 

当我运行这段代码并想要在Matlab中加载这个文件时,它给出了错误:

load('AB24 task_ipol_500Hz_7min_MARA.mat')

Error using load
Unable to read MAT-file
C:\MTB862015\eeglab2019_1\All task\_2_min7_task\_6_min7_MARA\AB24 task_ipol_500Hz_7min_MARA.mat.
Not a binary MAT-file. Try load -ASCII to read as text.

非常感谢!

转载请注明出处:http://www.hnlovelyyears.com/article/20230526/1794519.html