storing and manipulating columns of data



Hi,

Being used to deal with Octave / Matlab, I'm a bit confused by Ruby structures (arrays, hashes, etc). I have this data file "data.dat" with 3 columns:


1.240000 9.990000e-01 1.290000e-06
1.550000 1.000000e+00 2.920000e-06
2.066000 1.002000e+00 8.360000e-06
2.480000 1.001000e+00 1.520000e-05
2.755000 1.001000e+00 2.210000e-05
3.099000 1.003000e+00 3.570000e-05
3.444000 1.003000e+00 3.240000e-05
3.542000 1.003000e+00 1.720000e-05
4.133000 1.001000e+00 1.430000e-05
4.959000 1.001000e+00 2.400000e-05
6.199000 1.001000e+00 4.720000e-05
8.265000 9.990000e-01 1.210000e-04

I would like to think of the columns as arrays "a", "b", "c", execute a loop along their indices, pick the values i want, and do something with them. What would be a sensible data structure for this?
I can read this datafile line by line using IO:readlines("data.dat"), but I cannot find a way to refer to one column in the array of strings generated.


Best regards,

baptiste


.



Relevant Pages

  • Re: storing and manipulating columns of data
    ... Being used to deal with Octave / Matlab, I'm a bit confused by Ruby structures (arrays, hashes, etc). ... I have this data file "data.dat" with ...
    (comp.lang.ruby)
  • Re: reading a hash
    ... > I am writing a perl script to handle dictionary data. ... The data file has ... But that doesn't quite match your first explanation. ... A hash of hashes of arrays is one way, ...
    (perl.beginners)
  • Serial Port Communications Using Byte Array
    ... I have a question regarding the use of the mscomm control or Sax Comm ... I seem to be getting buffer overflow errors when trying to send ... I want to send data using byte arrays but I'm ... My old string routine opens the data file from the hard disk, ...
    (microsoft.public.vb.controls)
  • Re: opening existing files with OPEN()
    ... and if n is an integer constant and i an integer variable,... ... the first line of your data file giving the value of n ... data into arrays, but if it's a few thousand or less that might be OK ... whether you're using f77 or f95: ...
    (comp.lang.fortran)