02-13-2011 11:01 PM
I am trying to quickly put this in labview. I was wondering if someone could help me with it.
I need to create a very quick string matching program find matching strings in a serial incoming string find matches against a database of words, and output 00 if there is no match or a match ID if there is a match.
sequence. The last valid character will be FF to indicate the end of the sequence. Need to
for example the data batabase of words is
MatchID : word
01 : and
02 : but
03 :cat
04 :mat
05 : sat
If I have
Input : the cat satttt on the mat
I should be able to get this match ID
Input : the cat satttt on the mat
MatchID: 00 03 05 00 00 04
Thank you for your help.
agyna
02-13-2011 11:53 PM
try this
02-14-2011 04:29 AM - edited 02-14-2011 04:30 AM
(I think it is a disservice to clutter a simple concept with baggage like state machines, local variables, unneeded timeout events and complicated extra loops and shift registers. "Array to spreadsheet string" and "spreadsheet string to array" can replace most of it. Also the above code does not work right, because it does not correctly parse the satttt as "05". We need to use "match first string" instead.)
Here's a quick draft. Use it as a starting point. You still need to detect FF, for example.
02-14-2011 11:46 PM
Thanks guys, this is was so quick.
1 more and last think I forgot to ask:
How do I organise the database of words this way: the database will have a maximum of 2000 words. The longest word will have 12 characters.
But my problem here also is this: THE INCOMING STREAM WILL BE BUFFERED IN A MEMORY and the memory will be organized as 1024x32 bit memory, thus 4 characters stored in each line of memory.
Just want to use power of labview to help me in my testing system.
Is it possible to get the address (from the memory of each words or characters stored?) this will help to get both ID or memery location.
Thank a lot for your help.
Agyna.
02-15-2011 04:38 PM
It sounds like you're buffering the incoming stream in memory on an external device. What is this external device? Does it have any functions for doing direct memory access, or maybe determining memory locations? If not you might have to come up with some sort of system for determining the memory location of your data. It seems like it could vary wildly based on the size of the word.
02-15-2011 05:51 PM
- There is no external device but at some point we could be using a system with a FPGA or some asic.
(in this case is it possible to buffer it in this device) and how to do this with labview?
- How to determin the memory location if I decide not to use the FPGA?
-How to represente a database of 2000 words?
Thanks for your help
02-16-2011 02:08 PM
I have a feeling that this task will vary wildly based on the actual external device you will be using, and what functionality this device has for directly accessing its memory. As far as representing a database of 2000 words, it might be easier to maybe put some sort of character between each word in memory so you know where the spaces between words are, though that would increase the amount of memory you would need to store your words.
02-25-2011 12:17 AM
Thank you, the solution from Gaurav k is what I wanted. But I am stack again, don't see how to make it case Insensitive. seems a bit complicated.
Thank you.
Agyna
02-25-2011 12:21 AM
Never mind, I solved the case insensitive thing.
Thank you.