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: File I/O: Reading Formatted Text
Replies: 3   Last Post: Dec 29, 1997 9:10 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David A. Robinson

Posts: 1
Registered: 12/7/04
File I/O: Reading Formatted Text
Posted: Dec 22, 1997 10:13 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 SH-DH, 3620 Locust Walk | (o o)
Philadelphia, PA 19104 |-------------oOO--(_)--OOo--------------
V:(215) 573-3150 F:(215) 898-6200 |

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.