RE: Extraction of positive values from list of both +/- values
- To: mathgroup at smc.vnet.net
- Subject: [mg34644] RE: [mg34637] Extraction of positive values from list of both +/- values
- From: Juan Egea Garcia <jeg at um.es>
- Date: Fri, 31 May 2002 04:26:19 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Oscar, try whith Select[list,crit] and pure functions:
lstvals={700, 600, 500, 400, 300, 200, 100, -50, 100, -200, -300}
positive=Select[lstvals,#>0&]
if you want to extract the negative values you have just to write #<0&
instead of #>0&, and in the same way with any other criteria.
============================
Juan Egea Garcia
Atica - Dpto. Matematica Aplicada
Universidad de Murcia - http://www.um.es
España
+34 968367144
-----Mensaje original-----
De: O.A. Linares, M.D., Ph.D. [mailto:divinesaam at aol.com]
Enviado el: jueves, 30 de mayo de 2002 8:55
Para: mathgroup at smc.vnet.net
Asunto: [mg34637] Extraction of positive values from list of both +/-
values
Dear Colleagues,
I have a list of values:
lstvals={700, 600, 500, 400, 300, 200, 100, -50, 100, -200, -300}
I want to create a list that contains only the positive values. I know I can
use
lst=Take[lstvals, 7]
The problem is, the size of the vectors vary. Help appreciated.
Thanks,
Oscar