Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure does not sarts!

Solved!
Go to solution

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
M30

Download All
0 Kudos
Message 1 of 9
(4,462 Views)

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

0 Kudos
Message 2 of 9
(4,458 Views)

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.


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 3 of 9
(4,455 Views)

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!

0 Kudos
Message 4 of 9
(4,448 Views)
Solution
Accepted by topic author supershaheens

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.


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 5 of 9
(4,444 Views)

There comes no value after matvh pattren and no values shows in string 2 in a=file attached

Download All
0 Kudos
Message 6 of 9
(4,435 Views)

@supershaheens wrote:

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?


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 7 of 9
(4,426 Views)

File is attached! everything is working except the while loop stop function,it should stop and led on ardiuno should stop when M30 comes,but the LED remains turned on forever,it doesnot stops

Download All
0 Kudos
Message 8 of 9
(4,399 Views)

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.


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 9 of 9
(4,388 Views)