MathGroup Archive 2008

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

Search the Archive

Re: Replace non-numeric values in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88756] Re: Replace non-numeric values in a list
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 16 May 2008 05:28:39 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <g0h825$mtr$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

list //. {any___, a_, other___} /; ! NumericQ[a] :> {any, 0, other}

or

If[! NumericQ[#], 0, #] & /@ list
??

Regards
   Jens

Adel Elsabbagh wrote:
> Dear all,
> 
> I have a list that contains numeric and non-numeric values
> list = { a, 1, 2, b, 3};
> How can I replace non-numeric values with zeros?
> Thanks!
> 


  • Prev by Date: Re: Replace non-numeric values in a list
  • Next by Date: Re: Replace non-numeric values in a list
  • Previous by thread: Re: Replace non-numeric values in a list
  • Next by thread: Re: Replace non-numeric values in a list