comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: "clamping" an array to a maximum value?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: "clamping" an array to a maximum value? [message #13941 is a reply to message #13934] Tue, 22 December 1998 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Martin Schultz <mgs@io.harvard.edu> writes:
> Yup,
>
> that's what I really intended to say/write. BTW: How about a "last
> element" operator? I very often need something like
> subdata = data[*,0:n_elements(data[0,*])-1]
> which is not very aesthetic ;-) is it? It would just be great if one
> could write something like
> subdata = data[*,0:(*)-1] or anything with a similar short syntax
> In this case the parantheses would serve to distinguish between "all
> elements" and "last element". That's probably a little dangerous. Anyone
> with a better idea?

Yes, yes, a billion times yes! A billion is about the number of times
I could have used this capability.

Some present-day scripting languages allow you to supply negative
subscripts, to indicate indexing from the end rather than the front of
the array. data[-1] would indicate the last element, data[-2] the
second to last, etc. Powerful, but maybe *too* powerful.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: segmentation
Next Topic: 3D Scatter plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 11:23:32 PDT 2025

Total time taken to generate the page: 1.19996 seconds