home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / softsys / matlab / 175 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  1.9 KB

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