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


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

Re: How to Do a Replacement with Two Conditions

From Peter Breitfeld <phbrf@t-online.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to Do a Replacement with Two Conditions
Date 2011-06-17 10:09 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <itf94l$2ed$1@smc.vnet.net> (permalink)
References <itejv3$s36$1@smc.vnet.net>

Show all headers | View raw


Gregory Lypny wrote:

You may use Unitize

ll = {52, 5, 235, 256, 259, 4, 64, 233, 92, 201, 180}
Unitize[ll, 180]
Unitize[ll, 181]

> Hello everyone,
>
> I have a list of integers and I want to replace numbers bigger than 180 with one and those less than or equal to 180 with 0 to create a dummy variable.  The ones are easy:
>
> 	myList /. x_ /; x > 180 -> 1
>
> How do I get the zeros in there?
>
> Regards,
>
> Gregory
>

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

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


Thread

How to Do a Replacement with Two Conditions Gregory Lypny <gregory.lypny@videotron.ca> - 2011-06-17 04:08 +0000
  Re: How to Do a Replacement with Two Conditions Ray Koopman <koopman@sfu.ca> - 2011-06-17 09:51 +0000
  Re: How to Do a Replacement with Two Conditions Peter Breitfeld <phbrf@t-online.de> - 2011-06-17 10:09 +0000
  Re: How to Do a Replacement with Two Conditions Dan <dflatin@rcn.com> - 2011-06-18 21:44 +0000

csiph-web