Read csv

15 次查看(过去 30 天)
Kapil
Kapil 2011-4-5
How to read csv where the first column has strings and last column has string and all the other are integers.
I have tried csvread but it gives the error: ??? Error using ==> dlmread at 145 Mismatch between file and format string. Trouble reading number from file (row 1, field 3705) ==> Ag
Error in ==> csvread at 52 m=dlmread(filename, ',', r, c);
and if I use
textread('seen.csv','delimiter', ',') gives the error
??? Error using ==> dataread Param/value pairs must come in pairs.
Error in ==> textread at 176 [varargout{1:nlhs}]=dataread('file',varargin{:});
any idea?

回答(1 个)

Walter Roberson
Walter Roberson 2011-4-5
You cannot skip the format when using delimiter for textread()
The documentation for csvread says specifically that the file can contain only numeric values. You might be able to get away with string values (_perhaps_) if you specified the column range.

Community Treasure Hunt

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

Start Hunting!

Translated by