| Author |
Comment/Response |
curiousgeorge
|
01/24/12 10:41am
I've got an array which has a level that is nested within another. I'd like to flatten this specific level out, but I can't figure out how...
in short, I want to flatten an array from DIMENSIONS of {3,2,3,1,4} to {3,2,3,4} and I can't figure out how.
here's an example:
tmp = {{a, {b, c}, {{d, e}}}, {a, {b, c}, {{d, e}}}};
FlattenAt[tmp, {{1, 3}, {2, 3}}] yields {{a, {b, c}, {d, e}}, {a, {b, c}, {d, e}}}.
However, in order for this to work, I have to specifify each index pair in the 'flattenAt' command. This isn't a problem for small arrays, but when I have something with dimensions of {3,2,3,1,4}, it starts to become difficult. there has to be a better way to do this
thanks
cg
URL: , |
|