From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-18-2021 01:31 PM
Hello,
Please help,
I have a 2D array and I want to add values to the bottom of a single specific column. For example, an array with 3 rows and 3 columns and want to add more values to column 2.
The issue I'm having is that when I use the insert into array function, the information is only limited to the number of existing rows, therefore, LabView is not adding rows to accommodate the new values added to the column. Here's an example:
C1, C2, C3 C1, C2, C3
01, 0A, 0B 01, 0A, 0B
02, 0C, 01 02, 0C, 01
05, 0C, 0T 05, 0C, 0T
0B
0C
Thanks!
0M
08-18-2021 01:41 PM - edited 08-18-2021 01:42 PM
Use Build Array because Insert into Array will NOT add rows or columns.
08-18-2021 01:59 PM
Thanks for getting back to me. I tried your method, however, the column ends up getting added to the bottom of the array as a row. Is there a way to add it to the bottom of column 3?
Thanks,
08-18-2021 02:03 PM
@RTSLVU wrote:
Insert into Array will NOT add rows or columns.
What do you mean by this? Build Array is 100% the better choice, but Insert into Array can definitely add a row to the end if you just don't wire the index inputs. I'm only asking for my own edification.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
08-18-2021 02:10 PM
I'm trying to add more elements to the bottom of a specific column of a 2D array, however, if I use the build array function and wire the 2D array to the first node and the 1D array of in formation to the second node, it adds the data as a row to the bottom of the 2D array table. What I'm trying to do is add the information to the bottom of a column in vertical form.
For example, if I have a 2D array as the first set of data listed below. And I want to add more data to the bottom of column 2.
08-18-2021 02:11 PM
@floresma wrote:
Thanks for getting back to me. I tried your method, however, the column ends up getting added to the bottom of the array as a row. Is there a way to add it to the bottom of column 3?
Thanks,
NO, you have to add an entire row or column. Because all rows and column of an array MUST be the same length.
08-18-2021 02:12 PM
@FireFist-Redhawk wrote:
@RTSLVU wrote:
Insert into Array will NOT add rows or columns.
What do you mean by this? Build Array is 100% the better choice, but Insert into Array can definitely add a row to the end if you just don't wire the index inputs. I'm only asking for my own edification.
Right... I was mistaken that it wont add a row.
08-18-2021 04:58 PM
I think you can transpose the array and add a row, then re-transpose it.
08-18-2021 08:34 PM
My take on your requirement, may not be the best but gets your job done and scalable.
08-19-2021 11:13 AM - edited 08-19-2021 11:30 AM
@floresma wrote:
For example, if I have a 2D array as the first set of data listed below. And I want to add more data to the bottom of column 2.
Is this the entire task? What if you later want to add more data to one of the other columns, should the number of rows still grow by that amount or do you want to replace the existing zeroes?
For example
1 2 3
4 5 6
1 2 3
4 5 6
7
8
And you now want to add A B C to the first column, what should the result be?
1 2 3 1 2 3
4 5 6 4 5 6
0 7 0 A 7 0
0 8 0 or B 8 0
A 0 0 C 0 0
B 0 0
C 0 0
Can you take a step back and explain the purpose of all this? Maybe you should implement it as a ragged array by having a 1D array of clusters, each containing a 1D array representing a column of arbitrary length.
Also, if you know the final 2D array size, maybe you should start with a 2D array of the final size, padded with zeroes..