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?

=================

=================

1 Answer

1

=================

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

1

…or {{{a1,a2,a3},{b1,b2,b3}…}}}[[1]].

– David G. Stork

Oct 2 ’15 at 23:51