# How do I remove curly brackets around each element in a list? [duplicate]

I have a list/array like so:

{{{1}, {2}, {3}, {4}, {5}, {6}}, {{7}, {8}, {9}, {10}, ... }}


I want to remove the curly brackets around each element (so I can use ListDensityPlot) so that I have:

{{1, 2, 3, 4, 5, 6}, {7, 8, 9, ...}}

• Flatten[{{{1, 2}, {3, 4}, {5, 6}}, {{7, 8}, {9, 10}}}, {{1}, {2, 3}}]. (Pretty sure this is a dupe...) Jul 31 '17 at 16:34
• Or perhaps even Flatten /@ {{{1, 2}, {3, 4}, {5, 6}}, {{7, 8}, {9, 10}}}
– ktm
Jul 31 '17 at 16:40
• {{{1}, {2}, {3}, {4}, {5}, {6}}, {{7}, {8}, {9}, {10}}}[[All, All, 1]] Jul 31 '17 at 17:20
• With white-out? Jul 31 '17 at 18:29

list = {{{1}, {2}, {3}, {4}, {5}, {6}}, {{7}, {8}, {9}, {10}}};

Flatten /@ list


{{1, 2, 3, 4, 5, 6}, {7, 8, 9, 10}}

Or use the operator form

Map[Flatten] @ list


Just to put my comment on record, I propose

{{{1}, {2}, {3}, {4}, {5}, {6}}, {{7}, {8}, {9}, {10}}}[[All, All, 1]]


which gives

{{1, 2, 3, 4, 5, 6}, {7, 8, 9, 10}}

• I see that you have adopted my solution since this was last asked. ;^) Jul 31 '17 at 22:19
• @Mr.Wizard. Why not? Your methods are often the best, and I can still learn even at my advanced age. Jul 31 '17 at 23:59
• I am sincerely flattered. Also I strongly suspect your memory works better than mine, age notwithstanding. Aug 1 '17 at 9:46

list = {{{1}, {2}, {3}, {4}, {5}, {6}}, {{7}, {8}, {9}, {10}}};


Use Flatten to remove the inner brackets.

Flatten /@ list


Which gives:

{{1, 2, 3, 4, 5, 6}, {7, 8, 9, 10}}

• Isn't this the same answer as eldo's above? Jul 31 '17 at 19:27