LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove cluster from array of clusters

Solved!
Go to solution

Hi I have this program where you have an array of clusters and when you press a Boolean button 'Add', you can add clusters to the array till a certain limit and it gets written into a spreadsheet file. Likewise i want such a function that when you click on boolean "Remove" you can remove the cluster from the array so that the new array takes place of the old 1 and the cluster info is removed from spreadsheet file as well. How do I do it?

0 Kudos
Message 1 of 8
(1,535 Views)

Delete from array with a length of 1 is the simplest way here, and assuming performance is not an issue and you aren't trying to delete a bunch of elements in a loop at once this is the route I'd take. 

0 Kudos
Message 2 of 8
(1,531 Views)

You can use Insert/Build array to add the cluster to the array (Assuming you have the array or cluster already) and use Delete from array to remove the array element.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 8
(1,528 Views)

Hi i tried that but the problem is how do i replace the existing array with the new array w/ deleted element elegantly in the front panel? and will this automatically remove the element from the spreadsheet file as well? 

0 Kudos
Message 4 of 8
(1,524 Views)

Nope. I am not sure how you are writing a cluster to a spreadsheet file. Can you post the code that you have developed (In 2013 or lesser version please).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 8
(1,522 Views)
You need to provide more information. Does the delete remove first element, last element, or what?

You update the front panel indicator by writing to it.

Anything on file has to be read before you can delete anything and then you overwrite the existing file.
0 Kudos
Message 6 of 8
(1,519 Views)

Hi this is how the the element is being written into spreadsheet file. This is just a subVI. The main project is too large to attach. Deletion index will be taken from user and then that element should be removed. Thanks.

0 Kudos
Message 7 of 8
(1,512 Views)
Solution
Accepted by topic author shreya005

There is no need to have the cluster, instead use build array (for better performance initialize the array and use replace array subset primitive). You cannot remove elements from a file, but you can read the file and remove the element and write it back to the file. If this is a sub VI, are you adding/removing elements and writing to a file whenever the sub vi is called? Don't use write to Spreadsheet file VI in this case, instead use write to text file primitive. Check LabVIEW examples for some usefull examples on File IO.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 8
(1,506 Views)