10-21-2014 05:21 PM
I want to program a UI that can accept the number of dimensions as input and create an n-dimensional array as output. Anyone can help?
10-21-2014 05:24 PM
Sorry, I asked my question wrong.
The question should be:
If I have an n-dimensional array as input (the number of dimensions n is also an input), is there a way to traverse every element of the array?
10-21-2014 10:06 PM
Yes you can do that, but when the dimension "n" increase the number of index input required to access an element will also increase.
10-22-2014 06:58 AM
You can't dynamically set the number of dimensions in an array, if that is what you are asking. But you can initialize an array of any size. The Initialize Array can expand, so you can create an N dimensional array that way. LabVIEW has to know the data type, and the number of dimensions is part of the array data type.
10-22-2014 10:19 AM - edited 10-22-2014 10:27 AM
You can internally initialize an array with the maximum number of dimensions, then only fill some of the dimensions. Keep track of the highest "used" dimension.
You can easily traverse all used elements. What have you tried?
(easiest would be to reshape to a 1D array, then autoindex at a FOR loop boundary).