09-10-2010 02:16 PM
Hello,
I have 1D array of data set and need to store that information to Locals (2D array). Each loop I get 1D array data set and append to the 2D array Locals and at the end of the loop, read the Locals and analyze the data. How can I append 1D array to 2D array Locals variable (directly in TestStand)? Thank you in advance.
09-15-2010 05:20 PM
Hello, to insert into a 2d array you have to insert one element at a time. You will need another sub loop that runs through each element of the 1d array that you want to insert into your 2d array.
Hope that helps
09-17-2010 01:31 AM
Or you can try a trick with only one loop 😃 See the attachment.. The recipe is simple:
1. Create Custom data type - Array of ... (type "array" in the example)
2. Create Locals variable of your type "array" - Locals.array1D
3. Create 1D array of elements of type "array" - Locals.array2D
4. Perform a loop for Locals.array2D, on each iteration its current ellement will be defined
5. Access element of a 2D array via Locals.array2D[x][y].. Locals.array2D is a 1D array formaly, but its elements are 1D arrays too. That is why you get a 2D array
Hope that helps,
Max
02-11-2020 07:09 PM
Hi
1- Concatenate two arrays to a One Dimensional Array with the += Operator
(Locals.Combined2D += Parameters.Independant) += Parameters.Dependant
2- Re-Shape the result to a Two Dimensional Array using the length of one of the original Arrays as Parameter
Locals.Combined2D.Type.ArrayDimensions.SetBounds ( { 0 , 0 } , {Parameters.Independant.GetNumElements() - 1 , 1} )
04-07-2022 07:23 PM
this sequence contains an error:
(Locals.Combined2D += Parameters.Independant) += Parameters.Dependant
Expressions must evaluate to a value of the expected type