All I want to do is read the comma separated values from the text file and skip the first header row. Can somebody please tell me what is wrong with my code? I have attached the text file. Thanks!
FileID = fopen('test.txt','r');
C = textscan(FileID,'%f','HeaderLines',1,'Delimiter',',');
fclose(FileID);

1 件のコメント

dpb
dpb 2018 年 5 月 30 日
編集済み: dpb 2018 年 5 月 30 日
The time entry is not a valid floating point value so the format string is wrong. Look up the '%D' descriptor for times or, more simply, use readtable instead that will do a better job parsing the file format automagically.

サインインしてコメントする。

 採用された回答

KSSV
KSSV 2018 年 5 月 30 日

0 投票

FileID = fopen('data.txt','r');
C = textscan(FileID,'%s %f %f','HeaderLines',1,'Delimiter',',');
fclose(FileID);
C{1}
C{2}
C{3}

1 件のコメント

Preeti Sar
Preeti Sar 2018 年 5 月 31 日
Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2018 年 5 月 30 日

コメント済み:

2018 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by