Re: Command similar to flatten??
- To: mathgroup at smc.vnet.net
- Subject: [mg89292] Re: Command similar to flatten??
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 4 Jun 2008 05:36:31 -0400 (EDT)
On 6/3/08 at 3:59 AM, enoel2 at gmail.com (Erin Noel) wrote:
>I am pretty new to Mathematica coding so bear with me...
>I have a list of lists named "A" whose dimensions are {4,10,1100,5}
>and I want to basically "combine" those first two levels so that the
>dimensions become {40,1100,5} but I have no idea how to do
>that...Any suggestions?
You can apply Join to A, for example
In[19]:= data = RandomInteger[1, {4, 10, 1100, 5}];
Dimensions@data
Out[20]= {4,10,1100,5}
In[21]:= Dimensions[Join @@ data]
Out[21]= {40,1100,5}
Another alternative would be to use Flatten with its second
optional argument