11-08-2017 04:18 AM
Using the build array block;
Step 1: Concatenate a 2D empty array with a 1D empty array = empty 2D array,
Step 2: Concatenate a 1D array of data with an empty 1D array = 1D array
Step 3: Concatenate the 1D into the 2D and you get the 1D at row 1 instead of row 0
This can be fixed by transposing the empty 2D array created in step 1 before concatenating in step 3.
I'm a bit perplexed by this.Why would transposing an "empty" 2D array fix anything
Solved! Go to Solution.
11-08-2017 04:27 AM - edited 11-08-2017 04:28 AM
11-08-2017 04:37 AM
Why does the Empty 2D array contain a row? Nothing + nothing = nothing?
11-08-2017 06:19 AM
@Hefmister wrote:
Why does the Empty 2D array contain a row? Nothing + nothing = nothing?
Not entirely correct. When adding a 1D array to a 2D array, the 1D array goes in the N index (where N is the number of rows) and then N is incremented. So the empty 1D array goes into row 0 and the length is incremented to be 1 (number of rows is 1, number of columns is still 0). So when a real array gets added to the resulting 2D array, it goes into row 1 and the length incremented to 2.
There are plenty of debates floating around on similar issues with empty arrays and them having length. This one actually seems like a bug to me.
11-08-2017 07:22 AM
Hi crossrulz, thanks for the explanation. I don't think this can be "solved" in its raw form without a change in behaviour from Labview. I'll mark it as solved as we have some idea of what's going on.
11-08-2017 07:30 AM
Why are you building an empty array onto an empty array?
What do you expect the result to be? I know you are going to say and empty array. Which is what you did get because there are no elements existing in that array. But the rules how the dimensions of the array are handled need to be followed consistently whether the arrays are empty or have data.
If you have a 4 row by 3 column array and add a row, you expect to finish with a 5 row by 3 column array.
If you have a 0 row by 0 column array and add a row, then using the same array manipulation rules, you'll have a 1 row by 0 column array.
11-08-2017 08:08 AM
I see your logic.
To answer your question as to why I'm building an empty array onto an empty array...I can't show the actual code I'm debugging, instead I've stripped out the non essential components and attached it. This code is used in a chain where data is received and turn it into bitmaps.