LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I search and remove a specific string/text from a queue as you would from an array?

I need to enter text into an array in a specific order, so queues are great for this, but I also need to remove specific text from the array (that may be in the middle of the list or anywhere)thus I need a search and remove for specific strings. Please help...
0 Kudos
Message 1 of 6
(4,016 Views)
You could use the get queue status to return the array of elements in the queue then search the array then if found remove the elements you wish to remove. The flush queue could be used to remove all items from the queue then index the new array of information back into the queue. The flush queue could be used in place of the get queue status if you plan to remove an element each call.

Unless you are set on using the queue method another choice may be to create your own version. You could write a vi that includes a state machine allowing you to handle all your array manipulations based on the call to the vi. Various states could be insert, search, remove, sort. Use a shift register on a while loop to hold the array and an enumerated control to signal the sta
te to execute. Use a string control and indicator to pass information in and out of the vi.

I hope this helps.
Randall
0 Kudos
Message 2 of 6
(4,016 Views)
Hi,
thanks for the advice. I would rather not use a queue if I can help it, but I cant see any other way round. I have attached something to kind of show what I want to be able to do. I need the switches to enter the associated text into the list in the order the switrches are activated. I then need to delete the text associated with a switch when I press the second set of switches.

I could just use one cluster of switches that when each one is turned 'on' the text associated with it enters the list in the order activated, and when off the text dissapears.

Can you tell me how I flush the queue and then enter the data back into a queue?
Thanks very much

Alexi
0 Kudos
Message 3 of 6
(4,016 Views)
Looking at your sample I believe you are using version 7 yet the queue functions indicate to me the vi was probably originally wrote in version 5.1 or earlier.

Since then the event structure was added. Here is an example of how you could do the string manipulations you desire. I included an array method of doing the same. LV provides many ways to "skin the cat" here are just a couple of many possibilities for your solution. There may be others that closer meet your expectations.

Good Luck
Randall T.
Message 4 of 6
(4,016 Views)
For some reason the mechanical action of these buttons were changed. Here is the mocified version which should work.
Message 5 of 6
(4,016 Views)
Thanks a million, that is absolutely fantastic.
0 Kudos
Message 6 of 6
(4,016 Views)