LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from file

I was wondering if someone could help here. I have to read from a file line by line such that each time the word FAIL is found,

 

output each listed character follow by a tab and the corresponding number. For each missing character here give it the value found after FAIL.

 

for example from the attached file: in the first line I have FAIL 100 so I will output:

 

e          102

i            699

o          717

and I have to add the missing character of the alphabet that are not here and give them the value after FAIL

so, I will have

e          102

i            699

o          717

a          100

b         100

c          100

d         100

f         100

g          100

h         100

j          100

k          100

l          100

.

.

.

.

0 Kudos
Message 1 of 20
(3,618 Views)

Is this what you need? You didn't specify what the output should be, so I assumed an array would be fine. 

 

Note how this works. It uses regular expressions, which are pretty powerful. I look for the FAIL line with the first Match Regular Expression, and then I take everything after that match. Next, I look for the next FAIL line, and I take everything before that match. That gives the letters and numbers after the first FAIL line.

 

Then, wash, rinse and repeat as neeeded. Oh, well, skip the wash and rinse part, just repeat until the second one gives -1 for offset past match!

0 Kudos
Message 2 of 20
(3,585 Views)

Not really, But good indication. I need something like this but all the missing characters of the alphabet should also be listed and should have the value of the number after FAIL.

 

So in this case, let consider spot 1 of this output array, we have

e 102 
i 699 
o 717

 

but the rest of the alphabet is missing, a, b, c, d,f,g, h, j... are missing. And because they are not listed on the original list so I have to give them the value of FAIL ( the number coming after FAIL, which is 100 for this spot

so,

I will give them the value of 100

 

spot 1 will look like this:

e 102 
i 699 
o 717

a 100

b 100

c 100

d 100

f 100

g 100

.

.

.

spot2 will look like this:

 

c 103 
f 674 
t 512

a 147

b 147

d 147

e 147

.

.

.

Thanks for your help.

 

0 Kudos
Message 3 of 20
(3,568 Views)

That should be simple for you to add. Use the "whole match" output of the first Regular Expression primitive and wire that into the "input string" of a third Regular Expression primitive with the regular expression rule "Face [0-9]+  FAIL  ". The "after match" of the third Regular Expression will be the number (error code?) you are interested in. 

 

Then, write a little code to find out which letters you are missing in each iteration of the loop. Concatenate those missing letters with the number from the third Regular Expression primitive above. Concatenate that string with what is in each array element now and you'll have what you are looking for.

0 Kudos
Message 4 of 20
(3,553 Views)

Easy to say but seems to take me a lot of time.

I don't get this ..."and wire that into the "input string" of a third Regular Expression primitive with the regular expression rule "Face [0-9]+  FAIL  " . Can you clarify a bit?

0 Kudos
Message 5 of 20
(3,550 Views)

Oh, sorry about that!! I expanded on the original VI that I sent to you, but I didn't post it. 

 

This VI gets you what was originally posted, plus the "third Regular Expression primitive" that gets the error code for the rest of the alphabet. 

 

I attached the VI that gets the error code for the rest of the alphabet and a loop that finds what letters you have, so you know which ones you have to get. I bet you can get the rest of the alphabet and concatenate it with the error code that isn't in each array element Smiley Wink

0 Kudos
Message 6 of 20
(3,539 Views)

Thanks, I will trying.

0 Kudos
Message 7 of 20
(3,528 Views)

Good. Give it a try and if you get stuck I'll give you some hints!

0 Kudos
Message 8 of 20
(3,525 Views)

I definetly need some help here to get this done as we need it today. This is what I am trying but IAM REALLY STACK.

 

More help will help.

0 Kudos
Message 9 of 20
(3,520 Views)

I have LV2009, can you save for that?

0 Kudos
Message 10 of 20
(3,513 Views)