Paul Lutus wrote:

> You should be able to create an abbreviated version of your program that
> simply creates and displays the problem array. That would allow an easy
> analysis and fix.

Hi Paul,

I run your codes  and it works fine.

And here is my codes with the problem:

###
require 'pp'
require 'enumerator'


      file_name='C:\Ruby\self\exp\BMDC5-3H\EXPT.083'

       #read the data file
      data      =[]
      _1D_array=[]

      f=File.open(file_name)
      f.each do |line|
              next if line=~/CPM/
               # get the 3th column for each line
                _1D_array<<line.chomp.split()[2].to_f
       end

      # transform the 1D array into 2D array
       columns=12
     _1D_array.each_slice(columns) do|slice|
              data<<slice
     end

     pp data

###output
[[2294.4,
  3481.2,
  2716.7,
  1672.2,
  1135.3,
  2103.5,
  591.1,
  648.5,
  603.0,
  477.2,
  264.1,
  626.5],
...
[459.2,
  349.3,
  358.0,
  351.1,
  340.2,
  488.2,
  13.0,
  14.1,
  14.1,
  16.2,
  16.1,
  27.1]]
>Exit code: 0


-- 
Posted via http://www.ruby-forum.com/.