M
Maurizio Cirilli
Hi there,
I am a new member of this group and a newbie about Ruby. After a
not successful and
extensive search on this topic, I ask your help solving a problem in
picking out single subarrays
from a multidimesional array.
In short, I somehow stored the following m-array (single strings are
DNA codons):
ss = ["tcg", "agt", "tct", "agc", "tca", "tcc"], ["aaa", "aag"],
["ctg", "tta", "ctt", "cta", "ctc", "ttg"]]
What I would like to get are the separated arrays s[0], s[1] and s[2]
by iteration over array ss.
The method array.clone looks perfect for this aim:
irb(main):039:0> v0 = ss[0].clone
=> ["tcg", "agt", "tct", "agc", "tca", "tcc"]
but I did not find the right way to iterate this method over the m-
array and get indexed subarrays.
I tried iterations like:
v"#{n}"= ss.clone(n) do |n|
end
or
ss(n).each do |n|
v"#{n}" = ss.clone(n)
end
with no success.
Any help is greatly appreciated. Thanks.
-- Maurizio
I am a new member of this group and a newbie about Ruby. After a
not successful and
extensive search on this topic, I ask your help solving a problem in
picking out single subarrays
from a multidimesional array.
In short, I somehow stored the following m-array (single strings are
DNA codons):
ss = ["tcg", "agt", "tct", "agc", "tca", "tcc"], ["aaa", "aag"],
["ctg", "tta", "ctt", "cta", "ctc", "ttg"]]
What I would like to get are the separated arrays s[0], s[1] and s[2]
by iteration over array ss.
The method array.clone looks perfect for this aim:
irb(main):039:0> v0 = ss[0].clone
=> ["tcg", "agt", "tct", "agc", "tca", "tcc"]
but I did not find the right way to iterate this method over the m-
array and get indexed subarrays.
I tried iterations like:
v"#{n}"= ss.clone(n) do |n|
end
or
ss(n).each do |n|
v"#{n}" = ss.clone(n)
end
with no success.
Any help is greatly appreciated. Thanks.
-- Maurizio