MathGroup Archive 2009

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

Search the Archive

Re: problem of syntax.


micmac wrote:

> Hello everyone,
>
> 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.
>
> thanks,
>
> Julien
>

Suppose, you have the matrix

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

The Elements {1}, {2}, {3} and {4} are now on Level -2, as you can see
using TreeForm[mat].

Then use Replace on this Level to change the lists to their values:

Replace[mat,List[x_]->x, {-2}]

Out= {{1, 2}, {3, 4}}
-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: Re: old vs new(V7) BarChart3D
  • Next by Date: ToExpression[..,TexForm] does not seem to work on some Latex commands?
  • Previous by thread: Re: problem of syntax.
  • Next by thread: Re: problem of syntax.