How to import multiple data from .csv and analyse them?

1 vue (au cours des 30 derniers jours)
Bianca Motfolea
Bianca Motfolea le 4 Déc 2018
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.

Réponse acceptée

Bob Thompson
Bob Thompson le 4 Déc 2018
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.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by