How to extract the column_13 from 79 csv files and save into the new csv file
3 次查看(过去 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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!