Atomic_Sheep
21st January 2012, 14:46
I'm writing a basic program which will open a text file, read the data and plot it. The text files will have several formats of data i.e. one format will be something like this:
124 | 678 | 7890
4567 | 27487 | 5678
with varying numbers of rows and columns, and another text file will just have spaces separating the values
124 678 7890
4567 27487 5678
Firstly, how do I discern between values in a particular row? There's readLine() which will enable me to go down a list of values as I please but how do I go about specifying separation between values?
Secondly, in some cases, I'll be processing the data before plotting/graphing it. i.e. I might need to do basic mathematical operations on the values prior to spitting out final results, what would be the best method of working with potentially large volumes of data (not massive to the extent of gigabytes but possibly 20 megs or so although that's a guess). I mean, what would be an efficient way of working with it, simply use arrays? The operations will all be between values in the same row, so that simplifies it somewhat i.e. I won't be potentially accessing row 20 column 5 and multiplying it by row 1 column 239. Although I'll probably need to sort selected columns of the text document.
124 | 678 | 7890
4567 | 27487 | 5678
with varying numbers of rows and columns, and another text file will just have spaces separating the values
124 678 7890
4567 27487 5678
Firstly, how do I discern between values in a particular row? There's readLine() which will enable me to go down a list of values as I please but how do I go about specifying separation between values?
Secondly, in some cases, I'll be processing the data before plotting/graphing it. i.e. I might need to do basic mathematical operations on the values prior to spitting out final results, what would be the best method of working with potentially large volumes of data (not massive to the extent of gigabytes but possibly 20 megs or so although that's a guess). I mean, what would be an efficient way of working with it, simply use arrays? The operations will all be between values in the same row, so that simplifies it somewhat i.e. I won't be potentially accessing row 20 column 5 and multiplying it by row 1 column 239. Although I'll probably need to sort selected columns of the text document.