MATLAB r2016b problem with cvsread

4 views (last 30 days)
David Winthrop
David Winthrop on 10 Mar 2018
Commented: Walter Roberson on 9 Apr 2018
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 Comments
David Winthrop
David Winthrop on 10 Mar 2018
I will have to look into that. Thanks for the suggestion.

Sign in to comment.

Answers (1)

Jan
Jan on 12 Mar 2018
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 Comments
Walter Roberson
Walter Roberson on 9 Apr 2018
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()

Sign in to comment.

Categories

Find more on Entering Commands in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!