ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

resize 2D array

I read data from Excel into a 2D array in TestStand, after some data manipulation I have data i need to write to Excel via a 2D array, i need the sizes to be the same but they vary based on which input i read.  How can i resize my output array?  I've tried SetArrayBounds( Locals.valuesToExcel,"0",Str( Locals.i - 1)) with Locals.i = size of input +1

0 Kudos
Message 1 of 4
(4,927 Views)

i am using TS 2012 with office 2007

0 Kudos
Message 2 of 4
(4,926 Views)

For a 2d array you need two dimensions, but in your example you only show one. Did you really mean 2D or just that you want to resize a one dimensional array?

 

For a one dimensional array you can either do this:

 

SetArrayBounds( Locals.valuesToExcel, "[0]", Str( Locals.i - 1, "[%d]"))

 

Or this:

 

SetNumElements(Locals.valuesToExcel, Locals.i)

 

For a 2d array it would look something more like this:

 

SetArrayBounds( Locals.valuesToExcel, "[0][0]", Str( Locals.i - 1, "[%d]") + Str( Locals.secondDimensionUpperBound, "[%d]"))

 

Hope this helps,

-Doug

0 Kudos
Message 3 of 4
(4,912 Views)

I did mean 2D but wasn't sure how to make that expression, didn't know about the "[0][0]" so i'll give it a try, thanks

0 Kudos
Message 4 of 4
(4,903 Views)