1
$\begingroup$

I have a 3D array of the form:

{{{a1,a2,a3},{b1,b2,b3}...}}} 

and ListPlot3D only accepts data of form:

{{a1,a2,a3},{b1,b2,b3}...}. 

Is there any way I can convert from one to the other?

$\endgroup$
  • 1
    $\begingroup$ Flatten $\endgroup$ – Sektor Oct 2 '15 at 21:07
5
$\begingroup$

Assuming your initial list looks like this:

lis = {{{1, 2, 3}, {2, 3, 4}}}

You can remove the outer list with Flatten:

Flatten[lis,1]

Results in:

{{1, 2, 3}, {2, 3, 4}}

OR

You could replace the outer containing list with the actual function using apply:

ListPlot3D @@ {{{1, 2, 3}, {2, 3, 4}}}

Which is equivalent to,

Apply[ListPlot3D , {{{1, 2, 3}, {2, 3, 4}}}]
$\endgroup$
  • 1
    $\begingroup$ ...or {{{a1,a2,a3},{b1,b2,b3}...}}}[[1]]. $\endgroup$ – David G. Stork Oct 2 '15 at 23:51

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