LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare words in string to text in array

Hi everyone,

This is my first post and I am new to LabView.  I have managed to get two sets of data.  One is a column of M words like:

ball
jack
jill
dog

..etc...

and the other is a column of N passages like:

jack and jill went up the hill...
mary had a little lamb, its...
a half a pound of tuppenny rice...

...etc...

I am trying to create a logical test like:  If A from col1 exists in col2 return 1, if not return 0

This should result in an MxN matrix of 1's an zeros.  In this example, the first row would begin 0110... because jack and jill both exist in the first entry of col2.

If anyone can help I'd be most grateful!  I've been stuck on this all night!

Many thanks,

Izak.
0 Kudos
Message 1 of 2
(2,534 Views)
What have you tried so far?

All you need to do is use a couple of for loops. The first one you auto-index col2. The second you auto-index col1. In the innermost loop you just use a Match Pattern to see if the current item from col1 shows up in col2. Look at the offset past match output of the Match Pattern function. If it's non-negative you've got a match. I'd give you the code, but it's better if you try to code it yourself. You'll learn more that way. Smiley Wink
0 Kudos
Message 2 of 2
(2,530 Views)