NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

SetArrayBounds() giving me a strange output

Hello,

When I use SetArrayBounds(), the output is not consistent with what I am expecting, I'll try to give an example:

I have this random array of strings:

Locals.OfficeSupllies = { "Pen", "Paper","Stapler","Monitor","USB","Clips","Cables","Mouse","Keyboard"}.

Let's say I need to ridimension it to contain only the last 6 elements:

SetArrayBounds(Locals.OfficeSupllies ,"[3]","[8]"),

The above array of string becomes:

Locals.OfficeSupplies = {"Pen", "Paper","Stapler","Monitor","USB"} and it becomes an array of [3...8] so the first string ("Pen") has the index 3 and not 0.

 

Is this behavior normal? Shouldn't it be Locals.OfficeSupplies = {"Monitor","USB","Clips","Cables","Mouse","Keyboard"} and an array of [3...8]?

To apply what has been said above, these 2 lines can be used:

"Locals.OfficeSupllies = { "Pen", "Paper","Stapler","Monitor","USB","Clips","Cables","Mouse","Keyboard"},
SetArrayBounds(Locals.OfficeSupllies ,"[3]","[8]"),"

 

0 Kudos
Message 1 of 2
(47 Views)

SetArrayBounds(): "This function changes the bounds of an array. You can use this function to change the size and/or the number of dimensions of an array."

 

 

To do what you want to do, which is take a certain amount of elements and make that the array, you can just use this "Locals.OfficeSupplies = Locals.OfficeSupplies[3..8]"

Message 2 of 2
(21 Views)