11-11-2013 05:38 PM
I have a 2D array that I need to append another 2D array onto to add more columns. I'm performing a test which returns a 2D array of data. I then change a power supply setting and perform the test again. I collect the returned data into a 2D array that I'll reuse for each iteration. I the want a Statement step that will append the 2 D array to the end of a 2D array that starts out empty and will grow as the original 2D array is appended to it.
A00 A10 A20 B00 B10 B20 A00 A10 A20 B00 B10 B20
A01 A11 A21 B01 B11 B21 A01 A11 A21 B01 B11 B21
A02 A12 A22 + B02 B12 B22 = A02 A12 A22 B02 B12 B22
A03 A13 A23 B03 B13 B23 A03 A13 A23 B03 B13 B23
A04 A14 A24 B04 B14 B24 A04 A14 A24 B04 B14 B24
A05 A15 A25 B05 B15 B25 A05 A15 A25 B05 B15 B25
Solved! Go to Solution.
11-12-2013 10:51 AM
Hello kbbersch,
Please check to this example: http://forums.ni.com/t5/NI-TestStand/How-to-append-1D-array-to-2D-array-locals/td-p/1244638
Carmen C.
11-14-2013 09:27 AM - edited 11-14-2013 09:28 AM
I found that solution while searching but I'm actually trying to append a 2D to a 2D, not a 1D to a 2D. I may have to do a loop using that solution but I was hoping to find a way to just do it directly.
11-14-2013 11:11 AM
You could always use something like this example.
Hope this helps,
11-14-2013 11:52 AM
This is exactly what I was working on. I'm new enough to TestStand that I was struggling with the syntax of redimensioning the arrays.
It's interesting that when you readimension the arrays from 2D to 1D you don't have to move the data around. As long as there are the same number of elements they get populated with the data automatically. What happens if there are
more elements in the new 1D array than in the 2D array? Do I end up with empty elements or do I just lose all the data?
11-14-2013 12:19 PM
You end up with empy elements. Basically whatever the default value for the datatype of the array is.
11-14-2013 12:22 PM
BTW- I think it's a lot easier in the newer versions of TestStand. I haven't played with the new version though enough yet.
I do not like how the functions require "[0]" syntax. I wish it would just take in an index but I do understand why they do it... for the multi dimensional functionality.