LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

seperate particular byte from data string

Hi

I want seperate data from string.

1.First I have to seperate data with 07326203x

2 and then from 8 byte data (from each line) i just want to read 6 byte position from each line.

BR

kalu

0 Kudos
Message 1 of 9
(3,539 Views)

Easy enough.  What's your question?

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 9
(3,535 Views)

hi here I have attach my vi

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

No attachment.

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 4 of 9
(3,516 Views)

hi

Sorry I couldnot able to attach vi

so i make screenshot.,

my data look like

7.6562 4  07328203x        RX   d 8 , CA 00 10 00 00 0A 00 47 tid=00
   7.6562 4  07326203x        RX   d 8 , 01 00 01 00 00 00 00 04 tid=00
   7.8750 4  07315F03x        TX   d 8 , 3F 00 00 00 00 00 00 00 tid=00
   8.2969 4  07326203x        RX   d 8 , 00 00 00 00 00 00 00 04 tid=00
   8.9219 4  07328203x        RX   d 8 , CA 00 10 00 00 0A 00 47 tid=00
   8.9375 4  07326203x        RX   d 8 , 00 00 00 00 00 00 00 04 tid=00
   9.5625 4  07326203x        RX   d 8 , 00 00 02 00 00 00 00 04 tid=00
  10.2031 4  07328203x        RX   d 8 , CA 00 10 00 00 0A 00 47 tid=00
  10.2031 4  07326203x        RX   d 8 , 02 00 02 00 00 00 00 04 tid=00
  10.8437 4  07326203x        RX   d 8 , 02 00 02 00 00 00 00 04 tid=00
  11.4844 4  07328203x        RX   d 8 , CA 00 10 00 00 0A 00 47 tid=00
  11.4844 4  07326203x        RX   d 8 , 02 00 02 00 00 00 00 04 tid=00
  12.1250 4  07326203x        RX   d 8 , 02 00 02 00 00 00 00 04 tid=00

0 Kudos
Message 5 of 9
(3,509 Views)

main.jpg

0 Kudos
Message 6 of 9
(3,508 Views)

I've attached a LAbVIEW 2013 example that does what you want.  This example will not work if you don't have the OpenG tools installed as it uses the Multi-line String to Array function from them.  To install the OpenG toolkit you need to use VIPM, which comes with LabVIEW 2013 or can be downloaded and installed free from JKI.com.

 

Here's a snippet of the code.

Extract Byte Snippet.png

 

What I'm doing is converting the data to an array.  Each line is an element.  I then look search each element for your search string.  When I find the string I split get everything in the element after the comma, delete the white space from the front and back of the string, get the to characters at position 15 (assuming you want the 6th byte [1-8] not byte 6 [7-0]), and save that character to an array.  Youi end up with an array 6th bytes from every line that contained the search string.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 7 of 9
(3,496 Views)

Hi need i more help:)

 

I have a time stamp in string array and i need to evaluate time difference between new message with previous one. Problem is I convert String array to number and I got fixed number without decimal.String to num.png

 

0 Kudos
Message 8 of 9
(3,463 Views)

Hi kalu,

 

your problem is your regional setting! You use the comma as decimal separator whereas the string contains numbers using the point.

 

Please read the help for ScanFromString (or your string function), then read the linked help for "format codes". The use the correct format code "%.;%f"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(3,455 Views)