I have creared the vi but after matches the pattren the matching vale does not stars the specific case instead the default case runs please tell me whats the problem problem?is it in string?
code in put as text file is
A X01 Y04
C X03 Y05
A X04 Y08
C X07 Y09
Solved! Go to Solution.
I have creared the vi but after matches the pattren the matching vale does not starts the specific case instead the default case runs please tell me whats the problem problem?is it in string? code in put as text file is A X01 Y04 C X03 Y05 A X04 Y08 C X07 Y09 M30
I am not sure what you are trying to do with those little loops. Are you just looking to see if there is an 'A' in the string at all? Or are you looking for it in a specific location?
As it is now, you will always get an empty string out of the loop since it will only stop once it can no longer find a match. And the output tunnel is set to use the last match. Therefore, you will always run the Default case.
This is where probes could help you debug.
I'm looking if 'A' comes in my text file the case a should start and then, whole code which are before matching,will be matched again to separate 'X' and 'Y' and nnumbers,which are furher in the case,numbers will give me delay to start motors which will be interfaced with Ardinuo!
I recommend you do something like this. Read the entire file using the Read Lines configuration of the Read From Text File. You can then use a FOR loop with autoindexing to process each line in the file. You then just use a single Match Pattern (no loop) to look for the beginning of your string (A or C). Then we can do more searching for the exact parameters.
There comes no value after matvh pattren and no values shows in string 2 in a=file attached
Well, you still have that loop I told you to remove. Did you even look at the example I gave you?
1. Your outer loop should be a FOR loop, not a WHILE loop. This way the loop will stop when it reaches the last line of the file.
2. You do not need a seperate read of the same file. You can just compare the current string to "M30"
3. You should initialize your port before the main loop and close it after the loop. You can then do all of the reading and writing inside of the loop all you want. This will help eliminate issues of constantly opening and closing resources.