Read csv
显示 更早的评论
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
2011-4-5
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!