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


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

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

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to remove the Null character in a Table?
Date 2012-01-17 11:00 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jf3kd3$q9e$1@smc.vnet.net> (permalink)
References <201201162211.RAA15417@smc.vnet.net>

Show all headers | View raw


Table[If[i < 3, i], {i, 5}] /. Null -> Sequence[]

{1, 2}

Cases[Table[If[i < 3, i], {i, 5}], _?NumericQ]

{1, 2}


Bob Hanlon


On Mon, Jan 16, 2012 at 5:11 PM, Rex <aoirex@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?
>

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


Thread

Re: How to remove the Null character in a Table? Bob Hanlon <hanlonr357@gmail.com> - 2012-01-17 11:00 +0000

csiph-web