MATLAB: How to import multiple data from .csv and analyse them

.csv import data loopMATLAB

I have experimental data in 20 .csv files and I need to take a column from each of them to do the average and then to apply the formula and transform pressure in velocity. At the end I will need to plot everything.
I know how to do this for each of them but I don't know how to do a loop or something that woud give me the averages for the .csv filles at once.

Best Answer

files = dir('Your file directory'); % I suggest adding a *.csv to this to only get the .csv files.
for i = 1:length(files)
raw = csvread(files(i).name);
data(:,i) = raw(:,1); % Pick your column.
end
ave = mean(data); % Gives mean values of each set of data. Adjust as desired.
This is the basic structure I use for these types of things. Adjust as needed.