how to load multiple files from directory into an array using matlab?
이전 댓글 표시
i have a directory that includes some .mat files , i want to load all these files into an array .
i tried something like this :;
x1=load('C:\Users\me\OneDrive\Desktop\project\a\first_file.mat')
x2=load('C:\Users\me\OneDrive\Desktop\project\a\second_file.mat')
... and so on for all the files in the directory , and at the end i want to have an array such that:
arr(1)=x1 ...
how can i access the directory and load all of the files at the same time into an array ?
ps: i tried using path before and dir but then i got this error :
> error using eval , undefind function 'workspacefun' for input
> arguments of type struct
thank you in advance.
댓글 수: 5
Walter Roberson
2022년 8월 9일
Is there exactly one variable in the .mat file, and it has the same name in each case?
Is it a numeric row vector? Numeric column vector? 2D? 3D?
molan
2022년 8월 9일
Walter Roberson
2022년 8월 9일
Are the variable names the same inside the file? Is there exactly one variable in the file?
Does it matter which order the entries go into the overall matrix?
Are there any .mat files in the directory other than the ones to be processed ?
molan
2022년 8월 10일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!