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

Home » Public Forums » archive » Re: Working with lists
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: Working with lists [message #84393] Mon, 03 June 2013 21:23 Go to previous message
SonicKenking is currently offline  SonicKenking
Messages: 51
Registered: October 2010
Member
On Tuesday, June 4, 2013 7:09:06 AM UTC+10, fgg wrote:
> Different error, but still doesn't work here. Btw, I'm running IDL 8.0.1 on Windows 7.
>
>
>
> str = replicate('1000 1000.1515 400 40', 10)
>
> str = strsplit(str, /extract)
>
> array = float(str.ToArray())
>
>
>
> % LIST::TOARRAY: Unable to convert to type STRING: Element 7
>
> % Error occurred at: LIST::TOARRAY
>
> % $MAIN$
>
> % Execution halted at: $MAIN$
>
>
>
>
>
>
>
>> How about this:
>
>>
>
>>
>
>>
>
>> IDL> str = strsplit(str, /extract)
>
>>
>
>> IDL> str = replicate('1000 1000.1515 400 40', 10)
>
>>
>
>> IDL> str = strsplit(str, /extract)
>
>>
>
>> IDL> array = float(str.ToArray() )
>
>>
>
>> IDL> help, array
>
>>
>
>> ARRAY FLOAT = Array[10, 4]
>
>>
>
>> IDL> print, array[*,0]
>
>>
>
>> 1000.00 1000.00 1000.00 1000.00 1000.00 1000.00 1000.00 1000.00 1000.00 1000.00
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>> Helder

The error is probably due to your version of IDL.
Anyway, here is a solution without 8.0 features:

s = '1000 1000.1515 400 40'
array = rebin(float(strsplit(s, /extract)), 4, 10)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: points on a plot
Next Topic: Subscript by -1 HARD to Track Down

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

Current Time: Wed Oct 08 18:35:45 PDT 2025

Total time taken to generate the page: 0.00489 seconds