Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10130 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-05-18 09:28 +0000 |
| Last post | 2012-05-18 09:28 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Partition Help Bob Hanlon <hanlonr357@gmail.com> - 2012-05-18 09:28 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-05-18 09:28 +0000 |
| Subject | Re: Partition Help |
| Message-ID | <jp54no$gp0$1@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 top | Article view | comp.soft-sys.math.mathematica
csiph-web