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

Home » Public Forums » archive » assign an array to an element in another array
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: assign an array to an element in another array [message #90645 is a reply to message #90644] Thu, 19 March 2015 18:56 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
On Thursday, 19 March 2015 16:37:29 UTC-7, luc...@gmail.com wrote:
> Hello
> This is problem I have now,
> my data now looks like this
> 10 94 30 63 0.248019426 240 75
> [...]
>
> I want to create 25 seprate vectors naming them with the forst element of each row... like this
>
> vec10= [94 30 63 0.248019426 240 75]
> ...
>
> how can I extract this values individually and then add the "VEC" portion to the name?
>
> I have tried "foreach" , I have try to convert them to strings and add them together, and nothing yet.
>
>
> Thank you
>
> -LM*M

There is almost always a better way to do what you want, rather than piecing together variable names. A hash table (or "hash") comes to mind.

myHash = Hash()

; then do this kind of thing in a loop:

myHash[10] = [94, 30, 63, 0.248019426, 240, 75]

The "key" (10) can be any scalar and "value" (the vector) can be anything at all. For more options beyond Hash, look to OrderedHash and Dictionary, which are subtly different.

Hope this helps!

Cheers,
-Dick

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL Array Indices Command
Next Topic: IMSL won't load

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

Current Time: Wed Oct 08 20:14:32 PDT 2025

Total time taken to generate the page: 0.00381 seconds