Re: Replace non-numeric values in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg88755] Re: Replace non-numeric values in a list
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 16 May 2008 05:28:27 -0400 (EDT)
- References: <g0h825$mtr$1@smc.vnet.net>
list = {a, 1, 2, b, 3};
If[NumericQ[#], #, 1] & /@ list
{1, 1, 2, 1, 3}
--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
"Adel Elsabbagh" <aelsabbagh at gmail.com> wrote in message
news:g0h825$mtr$1 at smc.vnet.net...
> 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!
>
> --
> Adel Elsabbagh
> http://www.svlab-asu.com/aelsabbagh.html
>
>