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

Home » Public Forums » archive » list concatenation
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: list concatenation [message #92778 is a reply to message #92777] Fri, 26 February 2016 08:08 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
I was curious as to how this works (never used the ToArray method):

IDL> l = LIST(Findgen(3), Findgen(12), Findgen(5))
IDL> l
[
[0.0000000, 1.0000000, 2.0000000],
[0.0000000, 1.0000000, 2.0000000, 3.0000000, 4.0000000, 5.0000000,
6.0000000, 7.0000000, 8.0000000, 9.0000000, 10.000000, 11.000000],
[0.0000000, 1.0000000, 2.0000000, 3.0000000, 4.0000000]
]
IDL> help, l.toarray()
% LIST::TOARRAY: Unable to concatenate arrays: Element 1
% Execution halted at: $MAIN$


Nup. How about the DIMENSION keyword?

IDL> help, l.toarray(dimension=1)
<Expression> FLOAT = Array[20]

Huh. Cool.


On 02/26/16 11:04, Paul van Delst wrote:
> http://www.harrisgeospatial.com/docs/LIST.html#ToArrayMethod
>
> ?
>
> On 02/26/16 10:00, greg.addr@googlemail.com wrote:
>>
>> I've accumulated a list of variable length arrays, e.g.
>>
>> IDL> diam
>> [
>> [0.13860799, 0.035755500, 0.037822500],
>> [0.17081800],
>> [0.28975499, 0.050387200, 0.053300999],
>> [2.6970799, 1.3410200, 0.60130101],
>> [0.64086902, 0.61904001, 0.66626000, 0.27435899],
>> [0.86649197, 0.71003902],
>> [0.83967102, 0.47101700],
>> [0.18503401],
>>
>> ...
>>
>>
>> Is there a nice way to flatten this into a 1D array?
>>
>> cheers,
>> Greg
>>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: AWK inside idl
Next Topic: Running a code multiple times automatically

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

Current Time: Wed Oct 08 20:08:33 PDT 2025

Total time taken to generate the page: 0.02581 seconds