comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: list manipulation

Re: list manipulation
type: item
description: Hello Greg, normally with the List object you have to use the 'FindValue' method : IDL> A = indgen(10) IDL> B = indgen(10) + 10 IDL> C = indgen(3) + 50 IDL> lis = list(a,b,c, /extract) IDL> d = l.FindValue(10) IDL> print, d 10 vincent
creator: Vincent Sarago
date: 2011-12-18T12:33:48-00:00

Re: list manipulation
type: item
description: On Dec 18, 4:33 am, Vincent Sarago <vincent.sar...@orange.fr> wrote: > Hello Greg, > > normally with the List object you have to use the 'FindValue' method : > > IDL> A = indgen(10) > IDL> B = indgen(10) + 10 > IDL> C = indgen(3) + 50 > IDL> lis = list(a,b,c, /extract) > IDL> d = l.FindValue(10) > IDL> print, d > 10 > > vincent that is not working for me!!! Dave
creator: d.poreh
date: 2011-12-18T12:43:13-00:00

Re: list manipulation
type: item
description: DavePoreh writes: > > On Dec 18, 4:33 am, Vincent Sarago <vincent.sar...@orange.fr> wrote: >> Hello Greg, >> >> normally with the List object you have to use the 'FindValue' method : >> >> IDL> A = indgen(10) >> IDL> B = indgen(10) + 10 >> IDL> C = indgen(3) + 50 >> IDL> lis = list(a,b,c, /extract) >> IDL> d = l.FindValue(10) >> IDL> print, d >> 10 >> >> vincent > > that is not working for me!!! A common pedagogical device, used sometimes on exams, and extensively in newsgroups such as this, is to throw a little misdirection into the answer by slightly mistyping one of the otherwise clear directions. This not only gives the end user a sense of accomplishment in figuring something out for him or herself, but allows the answer provider to imagine that he isn't doing ALL the damn work! Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.idlcoyote.com/ Sepore ma de ni thui. ("Perhaps thou speakest truth.")
creator: David Fanning
date: 2011-12-18T14:59:01-00:00

Re: list manipulation
type: item
description: Thanks for that, Vincent (and the pedagogical device wasn't wasted on me!) This extract keyword is what I need, I think - except that it doesn't work the way I hoped in my case: IDL> a=list() IDL> a.add,[1,2,3] IDL> a.add,2 IDL> a.add,[3,4,5] IDL> b=list(a,/extract) IDL> print,b 1 2 3 2 3 4 5 I thought - ok, it thinks that's just one element, so what if I add another: IDL> b=list(a,[1],/extract) IDL> print,b 1 2 3 2 3 4 5 1 Still no. How would you get [1,2,3,2,3,4,5] from a? cheers, Greg
creator: greg.addr
date: 2011-12-18T18:22:43-00:00

Re: list manipulation
type: item
description: I tried like this, which works: IDL> b=list(a[0],a[1],a[2],/extract) IDL> print,b 1 2 3 2 3 4 5 ..but in real life, 'a' contains hundreds of short arrays, so that line's impractical. The following, which I could easily make - and would expect to be equivalent - doesn't work: IDL> b=list(a[[0,1,2]],/extract) IDL> print,b 1 2 3 2 3 4 5 Am I missing something obvious? cheers, Greg
creator: greg.addr
date: 2011-12-18T18:29:30-00:00

Re: list manipulation
type: item
description: On Dec 18, 10:29 am, greg.a...@googlemail.com wrote: > I tried like this, which works: > > IDL> b=list(a[0],a[1],a[2],/extract) > IDL> print,b > 1 > 2 > 3 > 2 > 3 > 4 > 5 > > ..but in real life, 'a' contains hundreds of short arrays, so that line's impractical. The following, which I could easily make - and would expect to be equivalent - doesn't work: > > IDL> b=list(a[[0,1,2]],/extract) > IDL> print,b > 1 2 3 > 2 > 3 4 5 > > Am I missing something obvious? > > cheers, > Greg Now it is something that sound working!! Cheers, Dave
creator: d.poreh
date: 2011-12-18T18:46:18-00:00