How can i go through a folder with a loop?

I have a folder full of different csv files. I need to run the same script for each one of them.
How can i do that?
Thanks in advance.

 Respuesta aceptada

KSSV
KSSV el 27 de Feb. de 2018
files = dir('*.csv') ; % you are in folder of csv files
N = length(files) ; % total number of files
% loop for each file
for i = 1:N
thisfile = files(i).name ;
% do what you want
end

1 comentario

rebecca wise
rebecca wise el 3 de Feb. de 2020
How would I then direct matlab to calculate the mean of the same column and sheet of all files?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 27 de Feb. de 2018

Comentada:

el 3 de Feb. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by