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

Home » Public Forums » archive » Re: How do you access a field in a struct?
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: How do you access a field in a struct? [message #18323 is a reply to message #18321] Wed, 15 December 1999 00:00 Go to previous message
Volker.Mertens is currently offline  Volker.Mertens
Messages: 1
Registered: December 1999
Junior Member
Karri Kaksonen <karri@twins.dna.fi> writes:

> Hi,
>
> I have a small problem with accessing my structs.
>
> The complete program (that does not work) looks like:
> pro beer
> a = { $
> beer: 1, $
> icecream: 2 $
> }
>
> b = { $
> milk: 0.60, $
> beer: 1.25, $
> icecream: 0.75, $
> tea: 0.50 $
> }
>
> totalsum = 0.0
> selection = tag_names(a)
> for i=0,n_tags(a)-1 do begin
i = execute('b_num = b.' + selection[i])
; if i ne 0 then ...
totalsum=totalsum + a.(i) * b_num
;>totalsum=totalsum + a.(i) * b.(selection[i])
> print, totalsum
> end
>
However, you should check if b really contains all a tags.


--
Volker Mertens email: Volker.Mertens@dlr.de
German Aerospace Center (DLR) Tel: +49 (0)30 67055 334
Rutherfordstr. 2 Fax: +49 (0)30 67055 386
12489 Berlin http://www.ba.dlr.de/NE-PE/
Germany
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Spatial normalisation
Next Topic: Changing elements in structures

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

Current Time: Tue Dec 02 13:08:40 PST 2025

Total time taken to generate the page: 0.18882 seconds