Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



File I/O: Reading Formatted Text
Posted:
Dec 22, 1997 10:13 PM


Greetings: I can't believe I'm posting this question, but I just spent all night trying to read a simple data file into Matlab, and I couldn't do it. I have an ASCII file that looks similar to this:
1990 year1 John Doe 1.123 2.234 3.345 1991 year2 Joe Sam Smith 2.234 3.765 4.654 1992 year2 Susan H. Jones 5.432 6.789 1.123
You get the idea  it's strictly formatted with 6 fields (in this example). I just need to get this thing assigned to Matlab variables/matrices. (Field three is 14 characters wide, as you suspected.) I don't know any C, so I'm new to fscanf, fgetl, etc. The Matlab (Ver. 5) documentation is next to worthless  it has a "detailed" discussion of how to read a single column of floating point numbers. Thank you very much.
Can someone help me out with this? I'm ready to blow a gasket, and I need to get on to the "real work."
Thanks in advance, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% David A. Robinson  The Wharton School, Univ. of PA  ''' 2314 SHDH, 3620 Locust Walk  (o o) Philadelphia, PA 19104 oOO(_)OOo V:(215) 5733150 F:(215) 8986200  robinson@wharton.upenn.edu



