Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Get rid of unwanted {}

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37267] Re: [mg37258] Get rid of unwanted {}
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Mon, 21 Oct 2002 02:29:34 -0400 (EDT)
  • References: <200210180918.FAA26146@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I'm not altogether sure I understood your problem, but it seems to me that
if

In[1]:=
lay={{{ob11},{ob12},{ob13},{ob14}},{{ob21},{ob22},{ob23},{ob24}}};

then

In[2]:=
Flatten[lay,1]
Out[2]=
{{ob11},{ob12},{ob13},{ob14},{ob21},{ob22},{ob23},{ob24}}

gets rid of the intermediate layer. Alternatively, List/@Flatten[lay].

Tomas Garza
Mexico City
----- Original Message -----
From: "JJJ Shen" <jushen1 at hotmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg37267] [mg37258] Get rid of unwanted {}


>
> Hi, Sorry for asking again a question regarding to the unwanted {}.
>
> I wrote a function, f, which accepts input having a form like:
>
> gg={{ob1},{ob2},{ob3}};
>
> However, the output of f having a form like:
>
> f[gg] gives {{{ob11}, {ob12}, {ob13}},{{ob21}, {ob22}, {ob23}, {ob24}},
...
> ,{{obn1}, {obn2}, {obn3}}}
>
> where the number of objects in each layer can vary.
>
> The additional "intermediate" layer in the output of f prevents the
feedback
> to f, when use function like nest.
>
> I looked up and tried several method, and it seems to be easy to get rid
of
> all inner layers, or the innerest layer, or the outmost layer (use
> Sequence).
>
> Is there a way to get rid of the middle layer as describe above?
>
> Thanks very much for your kind help.
>
> Sincerely,
> JT
>
>
>
>
> _________________________________________________________________
> Surf the Web without missing calls! Get MSN Broadband.
> http://resourcecenter.msn.com/access/plans/freeactivation.asp
>
>
>




  • Prev by Date: Re: Bad Alignment of Y Axes
  • Next by Date: Re: Again, How to speed up this calculation? and more
  • Previous by thread: Get rid of unwanted {}
  • Next by thread: Re: List processing (2)