MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: problem of syntax.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104354] Re: problem of syntax.
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 29 Oct 2009 02:55:03 -0500 (EST)

On 10/28/09 at 4:07 AM, julien.derr at dal.ca (micmac) wrote:

>For some reasons, I have a matrix where each element is itself
>another matrix of size one. How can I transform that in a normal
>matrix where each element is just the value ?

>I am very confused with mathematica syntax.

For issues like this, it is far better to post an actual
example. Without an example, I have to guess the nature of the
problem from your description. I interpret you as saying you
have something like

In[1]:= data = Table[{RandomInteger[10]}, {n, 3}, {j, 3}]

Out[1]= {{{0}, {10}, {2}}, {{6}, {3}, {3}}, {{2}, {3}, {10}}}

and you want to remove the braces immediately surrounding the
numbers. If I have this right then any of the following will do:

In[2]:= Join @@@ data

Out[2]= {{0, 10, 2}, {6, 3, 3}, {2, 3, 10}}

In[3]:= Flatten /@ data

Out[3]= {{0, 10, 2}, {6, 3, 3}, {2, 3, 10}}

In[4]:= ArrayFlatten@{Transpose@data}

Out[4]= {{0, 10, 2}, {6, 3, 3}, {2, 3, 10}}



  • Prev by Date: Re: ReplaceAll and rules from a list v7.0
  • Next by Date: Re: Re: old vs new(V7) BarChart3D
  • Previous by thread: Re: problem of syntax.
  • Next by thread: Re: problem of syntax.