如何加载具有可变文件名的.mat文件?

问题描述:

%select all .mat files

oar = dir('*oar.mat'); n = {oar.name};

%loop through files

for l=1:length(oar);

load pat_oar(l) %<---this is the .mat file with variable filename


clear ...

end

我如何编写一些Matlab脚本,该脚本将在一个.mat文件中依次读取...

How do I write some Matlab script that will read in one .mat file after another...

您的文件名存储在n中,因此您应该可以:

You file names are stored in n, so you should be able to do:

for l=1:length(oar)
    load(n{l})
end