Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: help reading csv file with string
Replies: 3   Last Post: Apr 2, 2012 7:30 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Guest

Watch Watch this User
Re: help reading csv file with string
Posted: Dec 16, 2010 6:33 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Walter Roberson <roberson@hushmail.com> wrote in message <f_jNo.4451$My1.4090@newsfe16.iad>...
> 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)]


I tried using the disp function and it was able to display the csv file. Can i add specific columns in the array done by the disp function into another array? Thanks. Really need your help



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.