LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to comparing enable indexing string with a string

If the first method by Dennis "worked" (your words!), you're only interested in the match count, right? In this case you might as well use my first example. Try it!
 
The second example by Dennis appends "something" to the array whenever a match occurs (could be a zero, a one, or anything else ;)) and then exclusively looks at the array size at the end, throwing out all other infomration contained in the array. The only solution that justifies this code construct would be to add [i] to the array, giving you an array containing the indices of all elements that matched. This can be useful information. 🙂
 
The code would look as follows, the false case just contains the array wired across. Don't forget to initialize the shift register with an empty array.
 
 

Message Edited by altenbach on 03-10-2007 11:00 AM

0 Kudos
Message 11 of 16
(652 Views)

Hi,

Sorry about this, but it still not what iam am looking for. What i need is each time the string matches the i get an output, if the string did not match i get a 0 at each comparison. I need something that gets an output at each comparison, NOT THE TOTAL NUMBER OF MATCHES. I am really no further when i started. It is my fault that i did not explain it correctly. So how can this be achieved. Because i have not idea.

king1

0 Kudos
Message 12 of 16
(651 Views)
I'm sorry. I don't know what you mean by output. All of these examples so far output something (i.e when a match occurs) but it's obviously not what you want. You're going to have to explain in greater detail what this output is supposed to be.
0 Kudos
Message 13 of 16
(631 Views)


@King1 wrote:
Sorry about this, but it still not what iam am looking for. What i need is each time the string matches the i get an output, if the string did not match i get a 0 at each comparison. I need something that gets an output at each comparison, NOT THE TOTAL NUMBER OF MATCHES.
Like any typical boss, you seem to change requirements every time you post. 🙂
If the string does not match and you get a 0, thats an "output" too.
 
 
Earlier, you clearly stated:


@King1 wrote:
ARRAY           STRING
Craig               Craig
Jon
Bill
Craig
 
This example would give an output of 2, because the string matches an element of the array.

An output of 2 is "THE TOTAL NUMBER OF MATCHES". Right?
 
So, lets clarify:
  1. How many outputs do you want? One for each element-by-element comparison or one for each element-array comparison?
  2. How should the output look like? number, array, etc. What should the array elements represent?
  3. What should the output be in your "Craig" example above if "2" is suddenly not the right answer?
    1. "2" = the total nuber of matches
    2. Array [1,0,0,1], one for matched elements, zero otherwise
    3. Array [0,3], indices of elements that matched
    4. something else?
  4. We provided solutions for 1...3. We cannot proceed without better job specifications. 🙂
Message 14 of 16
(630 Views)

O.k,

The way that it should work is using the craig example:

1. The string is compared with the first element of the array, a 1 is indicated at the indictor if it is equal, then the string is compared with the second element, since it does not match the indicator displays a 0. Then this is repeated until there are no more elements in the array.

ARRAY           STRING         Indicator
Craig               Craig               1
Jon                                          0
Bill                                           0
Craig                                       1
 
the key is that the indicator has to display either a 1 or a 0 at EACH COMPARISON. hopefully this explains what i am looking for. But i am very thankfull for the support you have provided.. (compare element against string then straight away display 1 if it matches and 0 if there is not match) this process of comparing then displaying is repeated over again until there are no more elements to compare the string with.
 
1:There should be one indicator displaying 1 or 0 at each element-by-element comparison,
2: the output should be either a 1 or a 0 . In this craig example the indicator will first be 1 then it will charges to 0 because we compared jon with craig and then again 0 because we compared bill with craig and  then the indicator will change to 1 at the last comparison becaus ethey match. AT EACH COMPARISON THE DISPLAY WILL DISPLAY EITHER A 1 OR  0. So we will see the indicator or display change to 1 then to 0 then to 0 then to 1.
 
 
 
thank you
 
KING1

Message Edited by King1 on 03-10-2007 03:18 PM

0 Kudos
Message 15 of 16
(626 Views)
That's exactly what your original code did. If there was a match, it displayed a 1 and if no match, it displayed a 0. It just happened so fast that you couldn't see it. You could of course, slow it it down so that it would be visible but I don't now what that would accomplish. Your term 'real time' has no meaning. Someone viewing the screen will have no idea when the comparison will take place. Even slowed down, take your eyes away from the screen for a moment and you won't see it. Think about it a littel more and what type of information you need to present and how to present it to someone actually using the program.
0 Kudos
Message 16 of 16
(622 Views)