Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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
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
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.")
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
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
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