LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i read a specific line from a text file, based on a numerical input from a PLC

I have a Data Socket that opens that opens and reads the input fromthe
PLC, the PLC send out an integer from 0-10...and then i open a file
where the messages for each number is stored. depending onthe number
sent i need to send out the corresponding message. i am using pattern
matching, read file and data sockets.

any suggestions on how to make this better... i get no proper sequence
of messages, only the first message if its set to "line mode" and all
the messages with a few changing messages otherwise.

thanks you,
cheers...
-U
0 Kudos
Message 1 of 4
(2,827 Views)
Keep the messages file in a string array. Or Read the messages file at
the beginning and create an array of offsets for each message.

P.Rayne wrote:
> I have a Data Socket that opens that opens and reads the input fromthe
> PLC, the PLC send out an integer from 0-10...and then i open a file
> where the messages for each number is stored. depending onthe number
> sent i need to send out the corresponding message. i am using pattern
> matching, read file and data sockets.
>
> any suggestions on how to make this better... i get no proper sequence
> of messages, only the first message if its set to "line mode" and all
> the messages with a few changing messages otherwise.
>
> thanks you,
> cheers...
> -U
0 Kudos
Message 2 of 4
(2,827 Views)
If all your messages are the same size, you can store them in an array and then index the array according to your input integer.

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 3 of 4
(2,827 Views)
I§ve got it done.. thanks!

chutla wrote in message news:<50650000000500000048160100-1042324653000@exchange.ni.com>...
> If all your messages are the same size, you can store them in an array
> and then index the array according to your input integer.
>
> Eric
0 Kudos
Message 4 of 4
(2,827 Views)