Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3171
| From | Dan <dflatin@rcn.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to Do a Replacement with Two Conditions |
| Date | 2011-06-18 21:44 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <itj673$k3o$1@smc.vnet.net> (permalink) |
| References | <itejv3$s36$1@smc.vnet.net> |
On Jun 17, 12:08 am, Gregory Lypny <gregory.ly...@videotron.ca> wrote:
> 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
Clip is made for this kind of problem.
Clip[myList-180,{0,1}]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll 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