Reading multiple csv files and save in a matrix
古いコメントを表示
Hello, I have multple csv files in a folder, I want to read them and store in a matrix, further, I also check for any duplicate entry in different files and sort the data in according to year and day. I am attaching one of the csv file here.
I tried foll. code:
SL_files = dir(sprintf('%s%s%s',fullfile(dirName),'\','*.csv'));
for idx = 1:size(SL_files,1)
disp(SL_files(idx,1).name)
fid = fopen(sprintf('%s%s%s',fullfile(dirName),'\',SL_files(idx,1).name));
filedata{idx} = textscan(fid, '%f%f%f %f:%f %f %f','Headerlines',16);
fclose(fid);
end
However, I am getting empty values after column 4. Any help? Thanks!
1 件のコメント
Poulomi Ganguli
2017 年 10 月 13 日
回答 (1 件)
KSSV
2017 年 10 月 12 日
0 投票
Use either xlsread or csvread to read the files.
3 件のコメント
Poulomi Ganguli
2017 年 10 月 12 日
編集済み: KSSV
2017 年 10 月 12 日
KSSV
2017 年 10 月 12 日
On using xlsread you can extract the numeric data, text data separately.
Poulomi Ganguli
2017 年 10 月 12 日
カテゴリ
ヘルプ センター および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!