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 で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!