Re: Re: Command similar to flatten??
- To: mathgroup at smc.vnet.net
- Subject: [mg89290] Re: [mg89275] Re: [mg89273] Command similar to flatten??
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 4 Jun 2008 05:36:09 -0400 (EDT)
- References: <200806030759.DAA19034@smc.vnet.net> <200806031044.GAA26637@smc.vnet.net>
On 3 Jun 2008, at 19:44, Andrzej Kozlowski wrote:
>
> On 3 Jun 2008, at 16:59, Erin Noel wrote:
>
>> Hi all,
>>
>> 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?
>> Thanks a lot in advance.
>>
>> Erin
>>
>
> Flatten[aa, {{1, 2}}]
>
> will do it.
>
> Andrzej Kozlowski
>
I meant of course Flatten[A,{{1,2}}] (I just used aa in my own example
which I did not post)
for example:
A = Array[a, {2, 3, 4, 5}];
Dimensions[A]
{2, 3, 1, 2}
B = Flatten[A, {{1, 2}}];
Dimensions[B]
{6, 1, 2}
Also, note that in the documentation to Flatten in version 6 it
clearly states:
Flatten[list, {{Subscript[s, 11], Subscript[s, 12], =85}, {Subscript[s,
21], Subscript[s, 22], =85}, =85}]
flattens list by combining all levels Subscript[s, ij] to make each
level i in the result.
- References:
- Command similar to flatten??
- From: "Erin Noel" <enoel2@gmail.com>
- Re: Command similar to flatten??
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Command similar to flatten??