From: Thomas Luedeke Date: 2012-10-03T04:24:50+09:00 Subject: Re: 2D array strategies 7stud -- wrote in post #1078413: > array2d = [ > ['a', 'b', 'c'], > ['x', 'y', 'z'] > ] > > puts array2d[1][0] > > --output:-- > x > > > array2d[0] << 'd' > p array2d > > --output:-- > [["a", "b", "c", "d"], ["x", "y", "z"]] > > > >> Set up a data structure to store at least one set of x versus y data. > > xy_data = [ > [1, 2], > [3, 4] > ] > >> Parse a file, looking to identify x versus y data for the >> first case out of an indeterminant overall number of cases. > > That is just pure gibberish. Getting ready to debate Obama? > >> If I find a subsequent case, add on an x versus y1 set of >> data to the original data structure > > More gibberish. How about a concrete example? OK. Try this as a file content: ============================================================= (BOF) Gibberish Gibberish Gibberish Case #1 Output 1 2 2 4 3 6 4 8 5 10 6 12 7 14 Gibberish Gibberish Gibberish Case #2 Output 1 1 2 3 3 5 4 7 5 9 6 11 7 13 Gibberish Gibberish Gibberish ========================================================== (EOF) I parse the file and identify the data associated with the first case, and load it up into an array. I then parse through gibberish until I identify the data associated with the second case. Now what? -- Posted via http://www.ruby-forum.com/.