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 from a text file
Replies: 2   Last Post: Jul 26, 2012 4:44 AM

Advanced Search

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

Posts: 91
Registered: 8/31/11
Re: help reading from a text file
Posted: Jul 26, 2012 4:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

TideMan <mulgor@gmail.com> wrote in message <5ae10137-5aaf-441e-8c49-4a6cd2f6972b@googlegroups.com>...
> On Thursday, July 26, 2012 8:32:10 AM UTC+12, vj wrote:
> > hi,
> >
> > I am using textread to read values from a text file.
> > when i use the following command,
> >
> > file = textread('1.txt','%s','delimiter','\n');
> > file{1,1}
> > ans =
> > C0-3F-0E-90-EE-13 6 "NETGEAR" -63 11.75
> >
> > I would want C0-3F-0E-90-EE-13,6,"NETGEAR"-63, 11.75 as a form a structure, instead of one variable.
> > I am not sure how to use the delimiter to get the same.
> >
> > Can someone please help me on this.

>
> Use textscan instead:
>
> fid=fopen('1.txt','rt');
> c=textscan(fid,'%s%f%s%f%f');
> fclose(fid);
>
> textscan assumes whitespace as the default delimiter
> c will be a cell array of your data


Thank you for your reply!! :) It helped me a lot!!



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

[Privacy Policy] [Terms of Use]

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