LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find the matching words from a text and write all of them

i have a homework and this program wants that prints the matching words and their number in the text, but it will also run when we type the desired word. i need help immediately

0 Kudos
Message 1 of 7
(867 Views)

Showing a truncated redacted picture of a front panel Does not really tell us your problems.

 

While we don't do your homework, we are happy to help, given sufficient information.

 

  • What does the program do?
  • What are the inputs and outputs?
  • Where does the text come from?
  • What is "prints"? Using a real printer or just display in an indicator?
  • Words don't have "numbers". Are you talking about word counts?
  • A proper state machine always "runs". I assume you want to update the indicators whenever the search word changes.

It is a weekend (even a long holiday weekend in the US!) and nobody likes unreasonable demands such as "i need help immediately". I suggest that you "immediately" look at your class notes and see if you can figure it out. See how far you get, then show us what you have and describe where you are stuck. If we see some effort, we might give you some pointers.

0 Kudos
Message 2 of 7
(857 Views)

Sorry for my rudeness. 

This program finds words in the text (also the word containing those letters) . Text comes from a .txt file but writed with hand.I want to write words in an array.

I dont know how to pull data.

in the first picture 'Ara' meaning search , its a search box. 

im talking about word counts. 

And yes i want to update the indicators whenever the search word changes.

 

 

0 Kudos
Message 3 of 7
(826 Views)

Nobody is asking you to solve all these problems unless all the required basics have been taught in class.

 

Can you explain what specific problem is preventing you from completing the assignment?

 

  • Can you read the text file?
  • Can you split the file into an array of words (delimiters are probably: space, comma&space, period&space, linefeed, tab, and maybe some others, depending on how the text is written). I am not even sure why you need an array, because you could just search the raw string directly, right?
  • Can your code read the control?
  • Can you do the searching?

 

If you have problems with any of the above, maybe this course is not for you.

0 Kudos
Message 4 of 7
(815 Views)

im searching and working on but i dont think im making any progress.

i want to take searched words from delimited string and show in an array.

i downloaded the question teachers wants from me. and the homework is what i did.

And thanks for the your help.

Download All
0 Kudos
Message 5 of 7
(810 Views)

i got this homework and i have done. thanks for the help

0 Kudos
Message 6 of 7
(724 Views)

@berkebb53 wrote:

and the homework is what i did.


 

You should NOT mark a post as "solution" unless you actually post the solution!

 

While it might work, there are some serious problem.

 

altenbach_1-1705336182885.png

 

 

  • Since the "search" control should not change during the execution of your loop, the control belongs before the loop. The code should not be forced to check for new values with every iteration and in the unlikely case where "search" would change during the loop, the result would be meaningless.
  • There are way too many unnecessary wire bends.
  • The front panel is way too big and disorganized,
  • Not sure what the purpose of the string array is, but assuming a single delimiter (tab) is probably too simplistic, as I already mentioned.

 

 

To count substring matches, all you need is the following:

 

altenbach_0-1705335988850.png

 

To parse the string into words given a collection of delimiters (tab, space, linefeed, comma, period, etc.) have a look at "scan string for tokens". A very useful tool to know.

0 Kudos
Message 7 of 7
(666 Views)