Re: List re-arrangement question
- To: mathgroup at smc.vnet.net
- Subject: [mg87769] Re: [mg87733] List re-arrangement question
- From: Carl Woll <carlw at wolfram.com>
- Date: Wed, 16 Apr 2008 22:30:37 -0400 (EDT)
- References: <200804160904.FAA24003@smc.vnet.net>
Yaroslav Bulatov wrote: >I'm trying to do something like the following: >Transpose[{{{a1, a2, a3}, {a1}, {a1, a2, a3}}, {{b1, b2, b3}, {b1}, >{b1, b2, b3}}}, {3, 1, 2}] > >expecting to get: >{{{a1, b1}, {a2, b2}, {a3, b3}}, {{a1, b1}}, {{a1, b1}, {a2, b2}, {a3, >b3}}} > >However, it looks like Transpose doesn't work with "ragged" >arrays...so what is the recommended Mathematica style to do the above >transformation? > > In version 6, you can use Flatten: Flatten[ {{{a1, a2, a3}, {a1}, {a1, a2, a3}}, {{b1, b2, b3}, {b1},{b1, b2, b3}}}, {{2}, {3}, {1}} ] {{{a1, b1}, {a2, b2}, {a3, b3}}, {{a1, b1}}, {{a1, b1}, {a2, b2}, {a3, b3}}} Carl Woll Wolfram Research
- References:
- List re-arrangement question
- From: Yaroslav Bulatov <yaroslavvb@gmail.com>
- List re-arrangement question