Clear Filters
Clear Filters

how to get string and numbers separately using csvread

9 views (last 30 days)
How to get string and numbers separately from csv file using csvread. I have a csv file with "A-Z" numerical columns and 100 rows. Column "AA" is string
How to get the numerical and text field separately using csvread
M = csvread(excelFileName, 1, 1, [1 1 100 26]);
Error using dlmread (line 143)
Mismatch between file and format string.
Trouble reading 'Numeric' field from file (row number 1, field number 27) ==>
Genuine,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...
Error in csvread (line 49)
m=dlmread(filename, ',', r, c, rng);

Accepted Answer

Jan
Jan on 20 Mar 2018
Edited: Jan on 20 Mar 2018
When you get an error message, start with reading the documentation:
doc csvread
There you find:
The file must contain only numeric values.
This mean clearly, that you cannot import your file using csvread because: 'Column "AA" is string'. Use textread or readtable instead.
Note: You are a long term user of this forum. It does not look efficient, if it is still required to suggest reading the documentation.

More Answers (0)

Categories

Find more on Data Import and Export in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!