![]() |
|
#1
|
|||
|
|||
Help extracting specific data from text fileI am very new to C++ and I have a project involving integration totals.
Please could someone help explain to me how to extract specific data out of a text file: The way the project works is that I have to take specific data (in this case, acceleration and time values) out of a text file which has been provided. I then need to apply a trapezoidal Riemann sum to the data in order to get velocity and then displacement. I have got the function for the Riemann sum worked out, all I need help with is how to get the data from the provided file. It is given in the form: time1 x-acceleration1 y-acceleration1 time2 x-acceleration2 y-acceleration2 time3 x-acceleration3 y-acceleration3 and is around 7000 lines of that, all numeric. What I would like to know is, how do I extract the data (and presumably save it to a variable) such as time 1, then time 2 etc. It is all separated by three spaces as shown. I attached a copy of the file, the columns are [time, x-acc, y-acc, x-disp, y-disp] I would really appreciate if anyone could show me how to pull out the specific data, and then use it in a calculation by way of storing it or using it directly. Much appreciated |
|||
|
#2
|
|||
|
|||
augmentIt didn't seem to attach the file last time, so I try again... But it doesn't seem to have worked.
|
|
#4
|
|||
|
|||
|
Some ideas:
CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Many thanksThanks so much for the assistance, it really helped me to understand and made my life easier. That tutorial looks great, I'm gonna give it a look now, so thanks to nkhambal.
Much appreciated, Dave Sinkula. The code was grande, it was more helpful than any of my lecturers! I suppose all I need to do now is apply the formulae to the data, and output it to a CSV file, which should be fine. I guess the text file uploaded after all. I think it didn't work the first time, because I tried to upload from Konqueror, and then in Firefox it seemed to have worked. Thanks again. |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 07:44 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 10:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The