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

Home » Public Forums » archive » Re: naming 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: naming elements in an array [message #29012 is a reply to message #28947] Thu, 24 January 2002 02:06 Go to previous message
Manish is currently offline  Manish
Messages: 20
Registered: April 2001
Junior Member
Cheers people, I realised you can reference the nth element in an array by
arrayname[n-1].
Quite a simple problem, which I realised the answer to straight after
posting and then was highly embarrassed at it's simplicity!

thanks for your help though, it's appreciated as I delve into the unfamiliar
world of IDL!

M.



"Andrew Cool" <andrew.cool@dsto.defence.gov.au> wrote in message
news:3C4C9599.AD9D0885@dsto.defence.gov.au...
>
>
> M wrote:
>>
>> Hi all,
>> I've just written a routine which returns a single column matrix array
of 14
>> elements - what I'd like to do is to assign individual names to each
value,
>> so they can be called in calculations later on.
>>
>> Does anyone know how I can do this? (Apologies if this is a 'trivial'
>> problem - I'm currently trying to teach myself the world if IDL, with
not
>> too much success!)
>>
>> Thanks for your time,
>>
>> Manish
>
> Shouldn't be too hard. What about this?
>
> zero = 0
> one = 1
> two = 2
> three = 3
> ..
> thirteen = 13
>
> Now you can reference your array with my_array(nine) to get the tenth
> element.
>
> Or what about :-
>
> the_median = my_array(0)
> the_sum = my_array(1)
> tenth_percentile = my_array(2)
> etc
>
> Is that what you mean? Or do you just want to access the values via a
> loop :-
>
> For i = 0,13 Do Begin
> value = my_array(i)
> ;do some gonculations on value
> End
>
> HTH,
>
> Andrew
>
> ------------------------------------------------------------ ---------
> Andrew D. Cool .->-.
> Electromagnetics & Propagation Group `-<-'
> Surveillance Systems Division Transmitted on
> Defence Science & Technology Organisation 100% recycled
> PO Box 1500, Salisbury electrons
> South Australia 5108
>
> Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
> Email : andrew.cool@dsto.defence.gov.au
> ------------------------------------------------------------ ---------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: problems producing a colobar
Next Topic: Re: Widget backgrounds

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

Current Time: Wed Oct 08 16:52:05 PDT 2025

Total time taken to generate the page: 0.00373 seconds