LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Iteration over arbitrary dimension

Let's say you have a 4-D array. Then one dimension can be said to be
the outermost dimension and one is the innermost. If the array is
wired to a FOR-loop, it will iterato over the outermost dimesion.

Sometimes, it would be convenient to iterate over another dimension,
e.g. the innermost. Are there any "elegant" solutions to this; any
time tested design patterns?


(
In this particular case, I have a 2-D array with 4 x 131072
items. The "long" dimension is a time axis with samples, and contains
data from different parts and aspects of a hardware array
(chip). There is also repeated measurements, which should be
averaged. Presently, the averaging is in the innermost dimension of
the resulting 4-D array, because of how data is ext
racted from the
original array, in which the samples to be averaged are consecutive'
)

A related question is: is it possible to swap dimensions in a
multidimensional array, similarly to, but more general than, the
transpose array for 2D-arrays?
0 Kudos
Message 1 of 3
(2,805 Views)
Helge Stenstrom wrote in message
news:m9bd74fh487.fsf@SPAM.ericsson.com...
> Let's say you have a 4-D array. Then one dimension can be said to be
> the outermost dimension and one is the innermost. If the array is
> wired to a FOR-loop, it will iterato over the outermost dimesion.
>
> Sometimes, it would be convenient to iterate over another dimension,
> e.g. the innermost. Are there any "elegant" solutions to this; any
> time tested design patterns?

Disable auto-indexing and use "index array" to iterate; use an "array size"
node to feed the iteration count input N of the for loop and feed the "index
array" node from the "count" node I of the loop.

> A related question is: is it possible to swap dimensions in a
> multid
imensional array, similarly to, but more general than, the
> transpose array for 2D-arrays?

Have a look at "Reshape Array"
0 Kudos
Message 2 of 3
(2,805 Views)
To access a portion of an array, you can use the "Index Array" vi located in the Array menu of the function palette. Resize the vi to accomodate the number of dimentions in your array. Disable the corresponding index by right-clicking in the index input and selecting "Disable index".

For example, to extract a single column of a 2D array, you must disable the first index; consequently, to extract a row you must disable the second index.

Hopefully this can help you with your situation.

Best regards;
Enrique
www.vartortech.com
0 Kudos
Message 3 of 3
(2,805 Views)