Loading multiple *mat files
조회 수: 2 (최근 30일)
이전 댓글 표시
all_data =[];
files = dir('*.mat');
for q = 1:lenght(files)
load(files(q).name);
all_data = [all_data D.F];
end
This is my code now but get an error load(files(q).name); saying error in read files... New to matlab so apologise in advance for silly mistakes.
댓글 수: 0
채택된 답변
Stephen23
2018년 1월 31일
편집: Stephen23
2018년 1월 31일
For a basic explanation see the MATLAB documentation:
If all of the .mat files contain the same variables then try something like this:
files = dir('*.mat');
out = load(files(1).name);
for k = 2:numel(files)
out(k) = load(files(k).name);
end
[out.F]
댓글 수: 1
Stephen23
2018년 1월 31일
@Elizabeth Dryburgh: please show the complete error message. This means all of the red text.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!