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

2 次查看(过去 30 天)
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

采纳的回答

Geoff Hayes
Geoff Hayes 2022-6-17
@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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Adding custom doc 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by