LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert binary string to values

Solved!
Go to solution
Highlighted

Hi, I'm stuck with a conversion of a string to values. Could somneone give my an advice how to convert my string to decimal values please?  Here is a pic of my string.

string.PNG

 

Thank you in advance. 

0 Kudos
Message 1 of 11
(262 Views)

Not nearly enough information to answer this question.  I suggest reading the manual so you can get an idea of what needs to happen so we can help you.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 11
(249 Views)

Well, what kind of data are you expecting? After the initial number series ending with 'u' i would assume it's binary written as string and a typecast to an array of U32 (or whatever is the correct data type) would get you far.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 11
(242 Views)

Where is this data string coming from?  Are you even sure you have all of the data?  It is looking similar to a protocol I have seen Keysight use.  The message starts with a "#" followed by a single ASCII character stating how long the length data is (in this case 8 ASCII characters).  The length is then 00001000.  So you should have 1000 bytes of raw data.  What is that data?  We need context to get any further.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 4 of 11
(232 Views)

We cannot work with a picture. At least attach a simple VI that contains the exact string data in e.g. a diagram constant.

 

We will only be able to help you once you provide full documentation. Where does the string come from (make&model of instrument, command used to request this reply, etc.)? Do you have the manual? Do you know the datatype? String structure of relevant parts? Byte order?


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 5 of 11
(220 Views)

Hi, Thank you for your reply. Yes, this data are from Agilent U2353. I need to convert this data to I16 format. 

 

Thank you in advance. 

0 Kudos
Message 6 of 11
(120 Views)

Have you take a string of 2 characters and tried typecasting it to an I16?

0 Kudos
Message 7 of 11
(115 Views)

I would guess that taking the string from offset 10 on and then passing through a Unflatten from String node, with the datatype set to an array of I16 is all that is needed. You then only have to play with the endianness input of that node to see if you need to set it to big or little endian to get the expected values.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
0 Kudos
Message 8 of 11
(112 Views)

And please, how could i use that type? how to implement it to that Unflatten from String node.

0 Kudos
Message 9 of 11
(96 Views)
Solution
Accepted by topic author kajo97

@kajo97 wrote:

And please, how could i use that type? how to implement it to that Unflatten from String node.


Connect it to the "type" input. 

 

Or are you asking how to create the type? Create an array constant, create a numeric, right-click the numeric and select "representation" and change to I16, drag the numeric into the array constant.



Certified LabVIEW Architect

G# - Award winning reference based OOP for LV, for free! VIPM Github
Message 10 of 11
(72 Views)