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?
Solved! Go to Solution.
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.
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.
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?
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).
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.
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.