Load several text files by a code in several tables / matrix
Show older comments
Hello,
I have a huge amount of text files saved in a folder.
I would like to write a code that recognizes how many files are saved in the folder and loads all of them in a unique table.
example.
file1 = table 1
file2 = table 2
...
x = amount of found and loaded files.
Answers (1)
David Hill
on 4 Apr 2022
Use a cell array to load all your tables.
n=dir;%assuming you are selected to the desired folder
for k=1:length(n)
f{k}=readtable(n(k).name);%assuming readtable works properly for your text files
end
1 Comment
Stephen23
on 4 Apr 2022
Categories
Find more on Text 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!