矩陣轉置

#!/usr/bin/ruby -Kuw

fname=ARGV[0]
arr=[]
File.open("#{fname}") { |file|
  while line=file.gets
   arr << line.chomp.split(',')
  end
}

tarr=[]
tarr=arr.transpose


for i in 0..tarr.size-1
  puts tarr[i].join(',')
end




arrow
arrow
    全站熱搜

    igogo 發表在 痞客邦 留言(0) 人氣()