LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Word search in 2D 4x4 character array.

Hi there,

I hope you are all doing well.

I am working on solving a LabVIEW problem and I am currently stuck. I have a string array of four words and a 2D array of characters. I want to search for each word in the 2D array. I have tried to create the logic, but it did not work as expected. Could you please help me with this? Specifically, which string palettes can assist me with this task? Any hints or suggestions would be greatly appreciated.

 

Below is my code and a screenshot of the task:

0 Kudos
Message 1 of 7
(367 Views)

As a first step, I recommend starting with the learning resources listed at the top of the forum.

 

  1. Your sequence structure has no purpose because execution order is already determined by dataflow. (It is possible that your teacher gave you that template, so just ignore it. Better programmers rarely need sequence structures)
  2. If you are autoindexing, you should not wire N (inner loop)
  3. Getting the first word from the words array converting it to a byte array, then back to the original word is a pointless detour.
  4. Do you really need 1s delays in the innermost loop? That will take forever to complete. Correctly done, the entire search will complete in microseconds.
  5. Your feedback nodes make no sense at all. There is no logic to it.
  6. What's the purpose of the "array" output?

As a first step, you need to define the problem, for example what is allowed for a word match (rows, columns, diagonals, zigzag, forward, reverse, any neighbor of the current character? etc.)

 

0 Kudos
Message 2 of 7
(328 Views)

The sequence structure serves as the template for this.

 

I wire N when I verify the logic without using auto-indexing.

 

The delay was implemented solely for debugging purposes to slow down the execution of the for loop; nothing more than that.

 

I can search for the word both vertically and horizontally only.

0 Kudos
Message 3 of 7
(301 Views)

@Hassan4488 wrote:

I can search for the word both vertically and horizontally only.


Then you only have 8 4-character strings (4 rows and 4 columns) and if you allow both direction for each, you would have 16. For each words in the list, iterate over these strings and see if the pattern exists.

 


@Hassan4488 wrote:

I wire N when I verify the logic without using auto-indexing..


But you use autoindexing. and the size is four, so wiring N=4 makes no difference.

 

 

 

0 Kudos
Message 4 of 7
(278 Views)

So is oath a valid find here:

 

altenbach_0-1727805687824.png

 

0 Kudos
Message 5 of 7
(223 Views)

Yes, it is, but what about the word "eat" ??

0 Kudos
Message 6 of 7
(221 Views)

I am done wtih finding the word 'oath', but I'm having difficulty with the word 'eat', which requires iteration in the backward direction in the second row. The letters 't', 'a', and 'e' are present, but I'm struggling to find it correctly.

Below is my code.

0 Kudos
Message 7 of 7
(219 Views)