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

Home » Public Forums » archive » Combing structures
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: Combing structures [message #72192 is a reply to message #71194] Mon, 16 August 2010 12:50 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Aug 16, 4:00 pm, Michael Williams <mjwilli...@gmail.com> wrote:
> function append_struct, tx, ty
>     tags = tag_names(tx)
>     s = 'tmp = create_struct("' + tags[0] + '", [tx.' + tags[0] + $
>         ', ty.' + tags[0] + '])'
>     void = execute(s)
>     for i = 1, n_elements(tags) - 1 do begin
>         s = 'tmp = create_struct(tmp, "' + tags[i] + '", [tx.' + tags[i] + $
>             ', ty.' + tags[i] + '])'
>         void = execute(s)
>     endfor
>     return, tmp
> end

That does not need to be so awkward. It could be done without execute,
with just

function append_struct, tx, ty
tags = tag_names(tx)
tmp=create_struct(tags[0],[tx.(0),ty.(0)])
for i = 1, n_elements(tags) - 1 do tmp=create_struct(tmp,tags[i],
[tx.(i),ty.(i)])
return, tmp
end

This could be made in a slightly easier way in IDL 8. But I do not see
a way to concatenate in one line as you want.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Smoothing Spline -- any existing efficient routines?
Next Topic: Re: getting GeoTiff Information

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

Current Time: Fri Oct 10 17:26:44 PDT 2025

Total time taken to generate the page: 1.29244 seconds