Load several text files by a code in several tables / matrix

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)

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

Asked:

on 4 Apr 2022

Commented:

on 4 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!