Given i have multiple csv files in a folder, how can i access it and read them?

 採用された回答

Lukas Bystricky
Lukas Bystricky 2015 年 8 月 4 日
Try something like this
files = dir('*.csv');
num_files = length(files);
results = cell(length(files), 1);
for i = 1:num_files
results{i} = xlsread(files(i).name);
end

3 件のコメント

yashvin
yashvin 2015 年 8 月 5 日
Thanks. Works great!!
Travis Briles
Travis Briles 2021 年 5 月 10 日
How do you do this if the files are stored in sub-folders within the main directory?
mahmoud abd elrehem
mahmoud abd elrehem 2022 年 8 月 29 日
You should select the path by command "pwd"

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Files and Folders についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by