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

Home » Public Forums » archive » Re: Help assigning values to ranges of elements in an array???
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: Help assigning values to ranges of elements in an array??? [message #5187] Thu, 12 October 1995 00:00 Go to previous message
peter is currently offline  peter
Messages: 80
Registered: February 1994
Member
Julian Marshall (jgm@nntp.unsw.EDU.AU) wrote:
: Hi.
: I was hoping someone could help me by suggesting a way by which
: I can assign values to a range of elements in an array. To be
: more exact, I want to make elements 0 to 100 (for eg.) of a
: 200 element array equal to a value or equal to values in a 100
: element array.
: Of course I can use for loops but I feel this is inefficient and
: a bit annoying when handling 256*256*256 bytarrs.
: IDL allows one to use an array operation to specify a range of
: values in an array (ie. A=B>10) but is it possible to use an
: array operation to specify a range of elements.
: Thanx

: julian
: jgm@newt.phys.unsw.edu.au
: .
:

You can specify a subarray on the LH side of an equation, so, for
example,

A(0:10) = 8

or

A(0:10) = B(10:20)

are legal, provided A is already allocated and big enough. For
assignment to more complicated shapes within A, you can collect all the
desired subscripts into another array, say, C, and use that to index A

A(C) = 0

Have a look at the chapter on array subscripting in the IDL manual, it
really is quite powerful.

Peter


--
--------------------------------
Peter Webb, HP Labs Medical Dept
E-Mail: peter_webb@hpl.hp.com
Phone: (415) 813-3756
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: limit of number vortices
Next Topic: HELP: IDL Function/Variable Problem

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

Current Time: Tue Mar 24 03:42:58 PDT 2026

Total time taken to generate the page: 2.39694 seconds