How can i go through a folder with a loop?

3 Ansichten (letzte 30 Tage)
Yagmur Gencoglu
Yagmur Gencoglu am 27 Feb. 2018
Kommentiert: rebecca wise am 3 Feb. 2020
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.

Akzeptierte Antwort

KSSV
KSSV am 27 Feb. 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 Kommentar
rebecca wise
rebecca wise am 3 Feb. 2020
How would I then direct matlab to calculate the mean of the same column and sheet of all files?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by