how to read multiple mat files and and extract data from those
Show older comments
I have a multiple .mat files (like 100 file) I need to load and extract specific data from those files. I.e to extract the row and columns so can anyone please help me out in this.
2 Comments
Kevin Chng
on 7 Oct 2018
mat = dir('*.mat');
for q = 1:length(mat)
load(mat(q).name);
end
Hi, i see there is answer in https://www.mathworks.com/matlabcentral/answers/139879-how-to-read-all-mat-files-from-a-folder-in-matlab
However, you are mentioning you want to extract specific data from those files. As per my knowledge, may be we need to know what is the name of variable in the mat file first.
May be you can attach few of your mat file, and further elaborate it. So may be some of expert here can try it out.
OriAlpha
on 7 Oct 2018
Accepted Answer
More Answers (1)
ANKUR KUMAR
on 7 Oct 2018
Whenever you wish to load all files, just use dir.
F=dir('*.mat')
for i =1:length(F)
load(F(i).name)
end
1 Comment
Stephen Owino Omondi
on 26 Aug 2021
Awesome
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!