|
|
Re: help reading csv file with string
Posted:
Dec 13, 2010 2:32 AM
|
|
On 13/12/10 1:16 AM, Anonymous wrote: > Hi, im not really good at Matlab so please bear with me, here's my > problem: I have a csv file that contains a plenty of row data like this > > 1,10/9/2010 > 05:42:59:390,0.25873534,0,0.25053943,0,0.26066645,0,0.26313331,0,0.6127435,0,0.015781,0,0.016664,0,0.016033,0,0.016664,0 > > > I would like to read the data in matlab and transform it into a matrix. > But matlab only reads csv files with pure numeric or text, how can i > remove the string section? What commands should i use? Thanks
I advise using textscan() with a 'Delimiter' of ',' and 'Whitespace' set to '' so that the space between the date and time is not treated as ending that particular cell. Use %f as the format for floating point numbers (or integers that you want to store as double precision), use %s for the date and time. It appears to me that an appropriate format would be ['%f%s', repmat('%f',1,18)]
|
|