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

 Respuesta aceptada

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 comentarios

Thanks. Works great!!
How do you do this if the files are stored in sub-folders within the main directory?
You should select the path by command "pwd"

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Files and Folders en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 4 de Ag. de 2015

Comentada:

el 29 de Ag. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by