Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: How to remove the Null character in a Table?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124330] Re: How to remove the Null character in a Table?
  • From: roby <roby.nowak at gmail.com>
  • Date: Tue, 17 Jan 2012 03:23:28 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jf13je$5ln$1@smc.vnet.net>

On 16 Jan., 13:01, Rex <aoi... at gmail.com> wrote:
> For example,
>
> Table[If[i < 3, i,], {i, 5}]
> will give
> {1, 2, Null, Null, Null}
>
> But I want the result to be {1,2}.
>
> Any trick for this?

trick no.1
Table[If[i < 3, i,], {i, 5}] // DeleteCases[#, Null] &

trick no.2
Table[If[i < 3, i, Sequence@@{}], {i, 5}]

and many other tricks ...

Cheers Robert



  • Prev by Date: Re: How to remove the Null character in a Table?
  • Next by Date: Re: Extract a part of expression
  • Previous by thread: Re: How to remove the Null character in a Table?
  • Next by thread: Re: How to remove the Null character in a Table?