6
$\begingroup$

Hi I'd like to transform the matrix :

{{{184.586, 1.02758*10^8}, {139.94, 4.07249*10^7}, {117.72, 
   2.26123*10^7}, {109.528, 1.51412*10^7}, {95.7636, 
   8.68593*10^6}, {78.125, 5.16118*10^6}, {66.6777, 
   3.1014*10^6}}, {{183.505, 1.01147*10^8}, {138.25, 
   4.02021*10^7}, {115.814, 2.24641*10^7}, {108.22, 
   1.50985*10^7}, {91.3082, 9.28241*10^6}, {78.1087, 
   6.03119*10^6}, {65.9855, 3.56718*10^6}}}

with the same transformation as

{{{a,b},{c,d}},{{e,f},{g,h}}} 

into

{{a,b},{c,d},{e,f},{g,h}}

How can I do plz ?

$\endgroup$
  • 1
    $\begingroup$ At least closely related: mathematica.stackexchange.com/q/5233/5478 $\endgroup$ – Kuba Jun 27 at 8:31
  • 2
    $\begingroup$ I guess gh is a typo and should be g, h. Anyway, it's a bit uncertain what you actually are trying to do. One way to achieve the structural change seen here is Join @@ {{{a,b},{c,d}},{{e,f},{g,h}}}... (This can be also defined as a function Apply[Join]. Another, probably more understandable way is Flatten[{{{a,b},{c,d}},{{e,f},{g,h}}}, 1]. $\endgroup$ – kirma Jun 27 at 8:38
8
$\begingroup$

Flatten might be something you need:

listNested = {{{a, b}, {c, d}}, {{e, f}, {g, h}}};
Flatten[listNested, {1, 2}]

output:

{{a, b}, {c, d}, {e, f}, {g, h}}
$\endgroup$
9
$\begingroup$
Catenate@list

where

list = {{{a,b},{c,d}},{{e,f},{g,h}}} 

{{a, b}, {c, d}, {e, f}, {g, h}}

$\endgroup$
6
$\begingroup$

You can also use Join:

Apply[Join] @ {{{a, b}, {c, d}}, {{e, f}, {g, h}}}

{{a, b}, {c, d}, {e, f}, {g, h}}

Alternative/equivalent form: Join @@ {{{a, b}, {c, d}}, {{e, f}, {g, h}}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.