LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Array: Add Row & Delete Row

Solved!
Go to solution

Hi Labview Community,

 

My objective is to take in a set of 8 inputs and store it into a 3x8 array where each set takes up 1 row. The inputs are only stored when the "add" button is pressed otherwise the 3x8 array is initialized to 0. I would also like to have the option to delete a row.

 

Currently, I can add only 1 row into the 3x8 array. When I untoggle the "add' button, the stored inputs disappear from the 3x8 array. How can I change the vi to be able to add multiple sets of inputs and have it update into the 3x8 array. Also, how can I approach deleting an entire row? Feel free to modify the attached vi.

BlockDiagram.PNGFrontDiagram.PNG

0 Kudos
Message 1 of 4
(3,534 Views)

If you read up on these topics, you should be well on your way:

 

Shift registers

Delete from array

Event structures

0 Kudos
Message 2 of 4
(3,524 Views)
Solution
Accepted by topic author qtism3
  • You need to built the 2D array in a shift register.
  • Your loops needs a wait
  • Your add button needs to be latch action.

Attached is a quick draft to add unlimited rows, one for each "add" click. You can have it automatically stop after 3 additions with a little bit more code. Try it. 😄

To delete a row, use "delete from array" in yet another case.

 

 

Message 3 of 4
(3,523 Views)

Thanks guys! I was able to successfully implement my objectives using both suggestions. Now onto the next obstacle!

0 Kudos
Message 4 of 4
(3,423 Views)