6

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 ?

J.A
  • 1,265
  • 5
  • 14
  • 1
    At least closely related: https://mathematica.stackexchange.com/q/5233/5478 – Kuba Jun 27 '19 at 08:31
  • 2
    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]. – kirma Jun 27 '19 at 08:38

3 Answers3

9
Catenate@list

where

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

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

user1066
  • 17,923
  • 3
  • 31
  • 49
8

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}}
sunt05
  • 4,367
  • 23
  • 34
6

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}}}

kglr
  • 394,356
  • 18
  • 477
  • 896