Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7907

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

From roby <roby.nowak@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to remove the Null character in a Table?
Date 2012-01-17 08:36 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jf3bu1$ne1$1@smc.vnet.net> (permalink)
References <jf13je$5ln$1@smc.vnet.net>

Show all headers | View raw


On 16 Jan., 13:01, Rex <aoi...@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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to remove the Null character in a Table? Rex <aoirex@gmail.com> - 2012-01-16 12:01 +0000
  Re: How to remove the Null character in a Table? roby <roby.nowak@gmail.com> - 2012-01-17 08:36 +0000
  Re: How to remove the Null character in a Table? David Reiss <dbreiss@gmail.com> - 2012-01-17 08:45 +0000
  Re: How to remove the Null character in a Table? Ray Koopman <koopman@sfu.ca> - 2012-01-17 08:47 +0000
  Re: How to remove the Null character in a Table? "andre.robin3" <andre.robin3@wanadoo.fr> - 2012-01-17 08:52 +0000

csiph-web