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: Read a textfile with textscan
Replies: 2   Last Post: May 26, 2008 4:47 AM

Advanced Search

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

Posts: 46
Registered: 12/6/04
Read a textfile with textscan
Posted: May 26, 2008 4:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Jos " <DELjos@jasenDEL.nl> wrote in message
> "Dani " <asdf@asdf.com> wrote in message
> <g1dnd2$t67$1@fred.mathworks.com>...

> > Hi.
> > I need to read a text file by lines, storing the result in a
> > cell array of string like the textread function does. The
> > problem is each line is compound of various strings
> > separated by whitespaces, and I want to retrieve the whole
> > content of each line, not as separated strings.
> > I think it can't be done with textread so I've tried with
> > textscan. But now the problem is that texscan returns a cel
> > array and I need a cell array of strings. How could I
> > convert it to an array of strings?
> > Thanks a lot.

> Use the proper delimiter:
> S = textread('file.txt','%s','delimiter','\n')
> hth
> Jos

Thank you.
I thought textread only accepted filename and format parameters.

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

[Privacy Policy] [Terms of Use]

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