How to extract the column_13 from 79 csv files and save into the new csv file

1 vue (au cours des 30 derniers jours)
Hi,
How to extract the column_13 from 79 csv files and save it in a separate csv file so the new csv file will have 79 column of column_13 from each file. I am able to read column_13 from one file but not sure how to extract from all the files and save it in a separate file.
Code Tried so far:
dataFolder = 'F:\3-PIV_Experimental_Data\Calculations_TurbulentIntensity\line_Data\Elliptical_Side_LSB\Length\DesignPoint\110_outlet';
list = dir(fullfile(P,'*.csv'));
for kk = 1:numel(list)
data = readtable(...
fullfile(list(kk).folder, list(kk).name));
extract = (data{:,13});
end

Réponse acceptée

Geoff Hayes
Geoff Hayes le 17 Juin 2022
@muhammad choudhry - create a cell array to store the 13th column from each file. For example,
extractedData = cell(numel(list),1);
for kk = 1:numel(list)
data = readtable(...
fullfile(list(kk).folder, list(kk).name));
extractedData{kk} = data{:,13};
end
Then you should be able to save the extractedData to your new file.

Plus de réponses (0)

Catégories

En savoir plus sur Adding custom doc dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by