08-16-2020 09:51 PM
I am reading hex values from a controller I want to match when certain messages occur and when all have occured I want it to stop the loop. Below I have a base of what I want but I can't figure out how to notify when all values of the array have been met. I took the VISA serial commands out an I am just using this little setup first.
The "Match First String" funtion is being used, it would be nice if it would output when a match has been met and then I could build and array and compare it to the input array but, I can't seem to solve this.
I also tried to use the index output and alert when an addition of the elements have been met, but I want to avoid duplicates that would affect the total sum. Any insight on this would be helpful. Thank you !
Solved! Go to Solution.
08-16-2020 10:03 PM
Initiailize a boolean array of false values the same size as your string array.
Whenever you find a match in the string array, replace the value in the boolean array with a True.
You'll know you have found all elements when AND Array Elements functions on the boolean array returns a True.
08-16-2020 10:31 PM
Hi,
The 'Match First String' index output -1 if no match is found, you can wire it to a 'Greater or equal to 0?' comparator such that it output 'False' if no match if found. You can then wire this to a case structure and wire the original string input into the case and process it in the 'True' case which is when a match is found.
You can refer to this link on how to remove duplicate from array.
08-17-2020 02:05 AM - edited 08-17-2020 02:10 AM
@TCChun wrote:
You can refer to this link on how to remove duplicate from array.
LabVIEW 19+ has a VIM in the array palette that does it using a set. much simpler!
For the original problem create a set of matching number (instead of an array). Use "remove from set" with each new string. Once the set is empty, all values have occurred. (Look in the new "collections" palette).
08-17-2020 02:11 AM
@altenbach wrote:
For the original problem create a set of matching number (instead of an array). Use "remove from set" with each new string. Once the set is empty, all values have occurred. (Look in the new "collections" palette).
Here's how that could look like: