home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!newsstand.cit.cornell.edu!ziklag.ee.cornell.edu!rz10
- From: Ray Zimmerman <rz10@cornell.edu>
- Newsgroups: comp.soft-sys.matlab
- Subject: Re: fscanf in v4.0
- Date: 26 Jan 1993 14:44:59 GMT
- Organization: Electrical Engineering, Cornell University
- Lines: 23
- Sender: rz10@cornell.edu (Verified)
- Distribution: world
- Message-ID: <1k3ipbINNhjf@newsstand.cit.cornell.edu>
- References: <C1Fqxv.HKo@taurus.cs.nps.navy.mil>
- NNTP-Posting-Host: ziklag.ee.cornell.edu
- X-UserAgent: Nuntius v1.1.1d17
- X-XXMessage-ID: <A78AB9CE7501E0B5@ziklag.ee.cornell.edu>
- X-XXDate: Tue, 26 Jan 93 14:50:06 GMT
-
- In article <C1Fqxv.HKo@taurus.cs.nps.navy.mil> Jim Stockel,
- stockel@taupo.oc.nps.navy.mil writes:
- >I'm fairly new to Matlab and have v4.0. A typical data file for me
- contains
- >some strings for documentation/plot labeling, and some data. I've tried
- >the [A,count] = fscanf(fid,'format',size) routine for reading strings,
- >but it leaves something to be desired. With no size argument,
- >it tries to read to the end of file. If a size argument is used
- >then that is the number of whitespace seperated groups of characters are
- >read (ie. words). Isn't there a way to read a newline terminated string?
- >Am I missing something? Is there a better way to read strings?
-
- Try "fgets" or "fgetl". If you need to extract pieces from the line
- you can do that with "sscanf". This is what I've been doing and it
- works ... but, as always, there may be a better way.
-
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Ray Zimmerman \ 397 Theory Center, Electrical Engineering
- \ Cornell University, Ithaca NY 14853
- Ray-Zimmerman@cornell.edu \ Phone: 607-254-8819 Fax: 607-255-9072
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- "The number you have dialed is imaginary.
- Rotate phone 90 degrees and try again."
-