LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match Certain word in a String

Solved!
Go to solution

Hi all,

 

I'm actually doing a project regrading e-learning. And i'm suppose to create a set of questions for each topics using labview. So Is there any way that i can match certain word in the string to make sure that answer is correct? Cause i'm sure that every user that input answer will be different. Thus, I want to pick out main point as an answer. Is there anyway i can do it?? 

 

Really appreciate your help!!! 

 

Thank you!! 

Download All
0 Kudos
Message 1 of 11
(3,930 Views)

You could use the Match Pattern inside of a FOR loop.  Iterate on your important points (which is an array of strings) and search in the given answer.  The index output of the Match Pattern will be -1 if it was not found.  So do a test of Greater or Equal to 0 on it for a pass.  If all pass (AND Array Elements), then the answer is correct.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(3,926 Views)

Sorry, but how do i (AND an array element)? 

0 Kudos
Message 3 of 11
(3,916 Views)

You can also look at the regular expression thread:

http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/td-p/1187799

 

To AND array elements, go the the functions palette, inside the Programming > Boolean palette, you will find "AND Array Elements", it looks like a triangle with an upside down 'A' in it.  Simply wire the array to the function and it will AND every element within the array.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

0 Kudos
Message 4 of 11
(3,911 Views)

@joseleen wrote:

Sorry, but how do i (AND an array element)? 


And Array Elements


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 11
(3,905 Views)

Sorry, i really still don't understand the AND array element. Can you please show me some examples or help me edit my program? 

Really appreciate your help 🙂 Thanks alot:) 

 

 

0 Kudos
Message 6 of 11
(3,900 Views)

123.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(3,889 Views)

AND Array elements is really simple..  Really..

 

Did you look at some of these tutorials.?

0 Kudos
Message 8 of 11
(3,886 Views)

Thank you!:) 

0 Kudos
Message 9 of 11
(3,877 Views)
Solution
Accepted by topic author joseleen

Here's another option (building on Jeff's code).  Turn on the Conditional Terminal on the FOR loop and change it to "Continue if TRUE".  This way, the loop will exit as soon as a failure is found.  Just pass the result straight out of the loop.  If none fail, then the FOR loop will exit on its own (from the auto-indexing) and a pass is passed out.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 11
(3,870 Views)