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


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

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

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to remove the Null character in a Table?
Date 2012-01-17 08:48 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jf3ck1$nmm$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 1/16/12 at 5:11 PM, aoirex@gmail.com (Rex) 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?

It is trivial to filter the Null. For example:

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

Out[5]= {1,2}

or simply use code that doesn't generate a Null, i.e.,

In[6]:= Cases[Range[5], _?(# < 3 &)]

Out[6]= {1,2}




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


Thread

Re: How to remove the Null character in a Table? Bill Rowe <readnews@sbcglobal.net> - 2012-01-17 08:48 +0000

csiph-web