The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 " <> wrote in message
> "Dani " <> wrote in message
> <g1dnd2$t67$>...

> > 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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.