Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Re: [mg5387] select a range of elements from a nested list
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Sherman Reed

Posts: 112
Registered: 12/7/04
Re: [mg5387] select a range of elements from a nested list
Posted: Dec 6, 1996 11:29 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

>At 07:50 PM 12/5/96 +0000, you wrote:
>>Hi MathGroup
>>
>>Say you have a nested list like that {{x1,y1},{x2,y2},{x3,y3},...{xn,yn}}
>>basically containing X and Y values for a XY plot in each element. The X
>>values span a range from say 0 to 0.4 and you ONLY want to select the
>>elements (x,y values) from the list for which the x value spans say 0 to
>>0.3. BUT you don't want to COUNT the elements (visually on the screen) and
>>figure out the position at which the x value is just greater than 0.3 and
>>then subtract 1 from this position.
>>
>>I still want do define the list by using
>>
>>Table[list[[x,1]],list[[x,2]],{x, 1, ZZZ}]
>>
>>here ZZZ means the number for which the x value <= 0.3, this number needs
>>to be found by MATHEMATICA!
>>
>>I like to know if there is a general procedure to select elements from a
>>nested list based on the values of one member of the elements of that
>>nested list.
>>
>>I hope I made myself clear enough to you all.
>>
>>Thanks a lot.
>>
>>Oliver Schurr
>>Department of Chemistry
>>Georgetown University
>>Washington, DC 20057
>>
>>

>Oliver,
>
>Below is a 2.2.3 version of what you requested. Take a look, and try it.
>
>I think it meets your specs. If you want a 3.0 version, I will be glad
>
>to help. If you want modifications, send me a note. The last four lines
>
>are simply a test of the package, and of course, can be deleted. If you
>
>have other needs, I will be glad to consider them.
>
>sincerely
>
>Sherman C. Reed
>AT&T-Bell Laboratories (Lucent Technologies), retired
>Sr. Lecturer and grad advisor, UTA-EE Department, retired
>

I forgot to include the Mma code in the first transmission, sorry.
scr


(*A Notebook to create a short list of a two element list
based on a limiting value of the first element of
the list by
Sherman C. Reed, sherman.reed@worldnet.att.net*)
shortList[origlist_,newlist_,xparam_]:=
Module[{},
newlist=Table[{0,0},{0}];
For[i=1,i<1+Length[origlist],i++,
If[origlist[[i,1]]<xparam,
AppendTo[newlist,origlist[[i]]]
]
]
];
data=Table[{Random[],Random[]},{20}];
ListPlot[data,PlotRange->{{0,1},{0,1}}]
shortList[data,data1,0.6]
ListPlot[data1,PlotRange->{{0,1},{0,1}}]








Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.