LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialising arrays

I just want to assign some array elements some values. Like:
array[8] = "hello"
array[2] = 34
like in 'C'

i am unable to find any function to do that.
thanks
0 Kudos
Message 1 of 3
(2,720 Views)
First, you need to have an array already initialized. If you do not have one, you can use hte function "Initialize Array" to create one. For a 1D array of strings, you can wire an empty array to "Element Data" input and the desired size to the "Dimension Size" input.

Now, you can assign the values to the specified elements using the "Replace Array Subset" vi.

If you attempt to add or modify an element in an uninitialized array, it will not work. Also note that you can't assign values to elements beyond the size of your array.

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 2 of 3
(2,720 Views)
Another way is to just create an array constant. First select it in the array palette and then put in the type of constant you want (string, number, etc.).
0 Kudos
Message 3 of 3
(2,720 Views)