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

6 visualizaciones (últimos 30 días)
Hi
T1=xlsread('file1.csv');
T2=xlsread('file2.csv');
...
How can i access each file in my folder and process them eventually?

Respuesta aceptada

Lukas Bystricky
Lukas Bystricky el 4 de Ag. de 2015
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
Travis Briles
Travis Briles el 10 de Mayo de 2021
How do you do this if the files are stored in sub-folders within the main directory?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by