Read 2 and 6 columns of multiple .csv files with different file names
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have tried the following code to read 2 and 6 columns of multiple .csv files (368) with different file names. Then i need to store in 368 arrays. Screen shot of the .csv file is shown below.
clear all
folder='<path>\csv';
filetype='*.csv';
f=fullfile(folder,filetype);
d=dir(f);
for k=1:numel(d);
data{k}=dlmread(fullfile(folder,d(k).name),' ',0,5);
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145160/image.jpeg)
But it does not work to accomplish my task.
Can somebody help me in this regard.?
Thanks in advance.
댓글 수: 0
답변 (1개)
dpb
2014년 8월 21일
From
help dlmread
dlmread Read ASCII delimited file.
...
All data in the input file must be numeric. dlmread does not operate
on files containing nonnumeric data, even if the specified rows and
columns for the read contain numeric data only.
csvread has the same limitation (not surprisingly, since it calls dlmread to do the work).
Use textscan or textread instead. Use
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!