For Looping to import .mat files
1 次查看(过去 30 天)
显示 更早的评论
Hi All,
I have a folder that I want to import all .mat files in from. So far I have got the following which identifies the amount of .mat files there are, however I am unsure how to import the .mat data in after this.
cd('D:\Leuven_Visit\Workflow\Matlab\Results\HV_NL');
procfiles=dir('*.mat');
nparticipants=size(procfiles,1);
for i=1:nparticipants
end
采纳的回答
Bhaskar R
2020-1-23
编辑:Bhaskar R
2020-1-23
procfiles = dir('D:\Leuven_Visit\Workflow\Matlab\Results\HV_NL\*.mat');% cd is not recommended
for iMat= 1:size(procfiles, 1)
load(fullfile(procfiles(iMat).folder, procfiles(iMat).name));
end
1 个评论
Stephen23
2020-1-23
Even better to load into an output variable (which is a scalar structure):
S = load(...)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!