Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10130
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Partition Help |
| Date | 2012-05-18 09:28 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jp54no$gp0$1@smc.vnet.net> (permalink) |
| References | <201205170808.EAA05007@smc.vnet.net> |
data = Array[a, {3, 6}]
{{a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6]}, {a[2, 1],
a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6]}, {a[3, 1], a[3, 2],
a[3, 3], a[3, 4], a[3, 5], a[3, 6]}}
Partition[#, 3] & /@ data
{{{a[1, 1], a[1, 2], a[1, 3]}, {a[1, 4], a[1, 5],
a[1, 6]}}, {{a[2, 1], a[2, 2], a[2, 3]}, {a[2, 4], a[2, 5],
a[2, 6]}}, {{a[3, 1], a[3, 2], a[3, 3]}, {a[3, 4], a[3, 5],
a[3, 6]}}}
% ==
Map[Flatten,
Partition[data, {1, 3}], {2}] ==
(Flatten[#, 1] & /@
Partition[data, {1, 3}])
True
Bob Hanlon
On Thu, May 17, 2012 at 4:08 AM, <sierrahotel71@gmail.com> wrote:
> I'm getting an extra set of braces when trying to partition a matrix and don't understand how to correctly write the function or remove the extra braces.
>
> data = (*Imported 6 column table*)
> d1 = Partition[data, {1, 3}]
> which results in {{{{-45000000, -10, 0}}, {{-419, 0, 1344}}},.....
> I need it to be
> {{{-45000000, -10, 0}, {-419, 0, 1344}},.......
>
> Any help appreciated
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Partition Help Bob Hanlon <hanlonr357@gmail.com> - 2012-05-18 09:28 +0000
csiph-web