Erorr using csvread dlm headerlines must be integer-valued
6 ビュー (過去 30 日間)
古いコメントを表示
I get the following error when using csvread:
Error using dlmread (line 147)HeaderLines must be integer-valued. Error in csvread (line 48) m=dlmread(filename, ',', r, c); Error in myDataProcessV2_2 (line 13) [Vg]=csvread(Data_File(j).name,'B251:B360');
I don't know how to solve it. I'd appreciate any help.
for j=1:counts(1)
[Vg]=csvread(Data_File(j).name,'B251:B360');
[Id]=csvread(Data_File(j).name,'E251:E360');
IdSize=size(IdAll);,
IdSize(1)=IdSize(1)/2;
Id=IdAll(1:IdSize(1));
Vg=VgAll(1:IdSize(1));
if j == 1
lgIdCollection=zeros(IdSize(1),counts(1));
end
lgId=zeros(IdSize);
sqrtId=zeros(IdSize);
for i=1:IdSize(1)
lgId(i)=log10(Id(i));
sqrtId(i)=sqrt(Id(i));
end
lgIdCollection(1:IdSize,j)=lgId;
onOffRatioCollection(j)=seekOnOffRatio(Id);
SSCollection(j)=seekSS(lgId,Vg);
[VonLocation,VonCollection(j)]=seekVon(Id,Vg,lgId);
[kmax,Vth]=seekVth(Id,Vg,VonLocation,sqrtId);
hysCollection(j)=seekHys(IdAll,VgAll,VonLocation,176);
mobilityCollection(j)=seekMobility(kmax);
end
0 件のコメント
回答 (2 件)
Nikilesh Chilkuru
2019 年 1 月 18 日
I believe this error is actually arising because the columns you are reading from a csv file might be non-numeric. And the key thing to note is both 'dlmread' and 'csvread' can read only numeric data. It's mentioned in the doc link: csvread
The best way to read data when there are non-numeric fields involved is to use textscan. You can specify the format of the data you want to read with textscan. To get more information, refer: https://stackoverflow.com/questions/13115569/error-when-reading-data-from-csv-file-into-matlab
1 件のコメント
Walter Roberson
2019 年 1 月 19 日
No, it is a plain positional parameter issue. Numeric R and C offsets have to appear before the character range expression.
Walter Roberson
2019 年 1 月 19 日
csvread() does not accept Excel-style character ranges in either the second or third parameter, only in the 4th parameter.
[Vg]=csvread(Data_File(j).name, 250, 1, 'B251:B360');
The 1 column offset matches to 'B' and the 250 row offset matches to '251'. The numeric values in the second and third parameters are relative offsets, so you would use 0 for A (first column), 0 for first row, whereas the Excel ranges are absolute rather than relative. If you give the wrong numeric values compared to the range string then it will give a warning.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!