Re: problem of syntax.
- To: mathgroup at smc.vnet.net
- Subject: [mg104366] Re: problem of syntax.
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Thu, 29 Oct 2009 02:57:21 -0500 (EST)
- References: <hc91nu$e3r$1@smc.vnet.net>
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