how to load multiple files from directory into an array using matlab?
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 9 Ago 2022
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
il 9 Ago 2022
Walter Roberson
il 9 Ago 2022
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
il 10 Ago 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su File Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!