08-25-2014 10:15 PM
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.
08-25-2014 10:24 PM - edited 08-25-2014 10:24 PM
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.
08-25-2014 10:26 PM
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.
08-25-2014 10:30 PM
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?
08-25-2014 10:32 PM
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).
08-25-2014 10:42 PM
08-25-2014 10:49 PM
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.
08-25-2014 10:58 PM
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.