MATLAB r2016b problem with cvsread

1 回表示 (過去 30 日間)
David Winthrop
David Winthrop 2018 年 3 月 10 日
コメント済み: Walter Roberson 2018 年 4 月 9 日
This makes no sense to me whatsoever. MATLAB will not read the requested data from the file even though it reads the same data from an almost identical file. MATLAB seems to be troubled by the column adjacent to the column from which I am requesting the data. WHY???
I did not ask MATLAB to read that column, as the image clearly shows.
I have included a screenshot of the error and both files. How can I get MATLAB to read these files?
  4 件のコメント
Von Duesenberg
Von Duesenberg 2018 年 3 月 10 日
Yes. I tend to use readtable because it does a good job at detecting the input format. Anyway, I'm afraid I can't help you out.
David Winthrop
David Winthrop 2018 年 3 月 10 日
I will have to look into that. Thanks for the suggestion.

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

回答 (1 件)

Jan
Jan 2018 年 3 月 12 日
The documentation of csvread explains clearly:
The file can only contain numeric values.
'null' is not a numeric value. Even if you are not interested in this column, it must be read and parsed to proceed to the next value. But it cannot be parsed as a number, such that csvread is not the appropriate tool for this file.
  2 件のコメント
David Winthrop
David Winthrop 2018 年 4 月 9 日
That is a serious design flaw.
Walter Roberson
Walter Roberson 2018 年 4 月 9 日
Since roughly 2015b-ish, csvread() can handle text in leading lines that you are skipping with the R argument, and it can handle text in leading columns that you are skipping with the C argument, but every row and column after that must be pure text.
The work-around is to use xlsread(), readtable(), or textscan()

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

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by