Subscripting multidimensional arrays [message #37287] |
Fri, 12 December 2003 01:04 |
Jonathan Greenberg
Messages: 91 Registered: November 2002
|
Member |
|
|
Hi all -- I was hoping to get some help with converting a vector which
contains the x,y,z position for a value I want to exract from a
multidimensional array -- I understand that using an array to subscript
another array requires knowing the linear subscript position. For example:
a = 0 10 20
30 40 50
60 70 80
90 100 110
120 130 140
150 160 170
I have a vector which is defined as:
locationvector=[2,2,2]
I want to extract the value at that position (e.g. a[2,2,2] = 170), but I
can't do a:
a[locationvector] --> I apparently have to convert the locationvector to
that linear position. How do I do this? Does IDL have a built in function
that will do this conversion, or is there an easy formula for doing this
conversion in ANY dimension? Thanks!
--j
|
|
|