LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Erasing lines from array

Below is an example of a vi that I have already.  I load a list of steps into the table labeled steps.  I can click on a step and it shows in the selected step string.  When I press add to procedure, it adds that selected step to the procedure table.  How can I make it so that I can erase the last step (if I wanted to) and also so I can clear the whole procedure table (if I wanted to) while the program is still executing?
0 Kudos
Message 1 of 5
(2,490 Views)
Move the array outside the sequence structure so you can wire data into it from additional cases and create 2 new cases. In one use the Delete From Array VI (you can determine what the last element is by using Array Size and substracting 1) and in the other wire an empty array to the tunnel.
 
Another point is that you have your user interface divided in 2. Instead of having 2 while loops, have the code for the boolean as an additional case. This is problematic because if, for example, you pressed one of the other buttons while the boolean is false, nothing would happen but the event would still be registered.
 
Additional comments:
 
Don't use the Stop VI. Your VI should stop simply because the loop ended.
 
Make sure your boolean terminals are in the cases so they can be read, otherwise they won't latch.
 
You don't need to wire default value (-1 for the timeout, the F for the stop condition), but that's a matter of personal style.
 
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
Message 2 of 5
(2,478 Views)
I tried using replace subset array to clear the procedure but it doesn't do anything and i tried using delete from array but it doesn't work either.  What else can I use to clear the array?
0 Kudos
Message 3 of 5
(2,468 Views)

You can do that with the second case I refered to - wire an empty array constant into the tunnel.

To create the constant, you can right click the terminal and select Create>>Constant. If the constant still has data, you can right click it and clear it in the Data Operations menu.


___________________
Try to take over the world!
Message 4 of 5
(2,462 Views)

In addition to the comments by tst....

I have no idea why you use 2D tables and multicolumn listboxes for simple single column data. Use single column listboxes!

It is also quite inconvenient if the user must (1) double click and (2) add an item. Why not add the double-clicked item directly so you don't need to feed it in a shift register? Add a button for "clear last" and "clear all" (at least) so the user can undo the actions.

Attached is a quick cleanup of your code. See if you can use some of the ideas ;). Good luck! (LabVIEW 7.1)

Message 5 of 5
(2,453 Views)