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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appending element into 2d array at a specific row and column?

Solved!
Go to solution

I can't seem to figure out after 3 hours how to append a 1d array onto a 2d array on a specified column. 

I would just like to be able to insert a new value at the end of different columns but labview doesn't like you accessing a specific row column combination for some reason. Attached is one of different things I've tried to do to append a value onto an already existing column but it just makes a new column. When I do row x column -1 it just inserts it into the column before but moves the old value over into a new column, very confusing.

 

 

0 Kudos
Message 1 of 6
(2,181 Views)

First, run your VI with some data saved into the controls and set them to be default values,  save and attach that.

 

Second, go back and take some tutorials on arrays.

 

What you are doing makes no sense.  For instance, if you have a 3 x 4 array, you are taking the size of that and multiplying the number of rows and columns together.  So in this case, it would be 12.  Then trying to Insert into Array at column 12.  You can't do that because you don't have columns  after #3 or 4.  As soon as you have two or more rows and two or more columns, then your scheme fails.

 

Give an example of what you have and what you want the result to be.

 

 

Message 2 of 6
(2,154 Views)

You cannot insert a column unless it is adjacent to an existing columns. Typically, the product of the dimensions is >> that the highest column, so this will not work.

 

Can you explain graphically with some typical data (none of your controls contain default data so far!) what and where you want to "insert" something (note that you say "append" in the subject, which is again something else).

 

so if your 2D array s e.g.

 

1 2 3

4 5 6

6 7 8

 

What would be the value and size of the "element 2" 1D array and what result would you expect?

Message 3 of 6
(2,152 Views)
Solution
Accepted by crash_override

"I would just like to be able to insert a new value at the end of different columns"

 

This would just be adding a row. You can use "build array" for that.

 

Capture.PNG

Message 4 of 6
(2,145 Views)
Solution
Accepted by crash_override

@Gregory wrote:

This would just be adding a row. You can use "build array" for that.

 


The OP never really talked about rows. There is no way to make sense of the jumble of "different column", "specified column", "append", "insert", "replace" (in the file name), etc.

 

Of course anything can be inserted anywhere, it is just a matter of padding first. 😉

Message 5 of 6
(2,139 Views)

This helped me because I realized I can just pad zeros to get to the end of the column I want but you have to insert stuff into those other rows. I used build array.

0 Kudos
Message 6 of 6
(2,058 Views)