11-04-2019 09:05 AM
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.
Thank you in advance.
Solved! Go to Solution.
11-04-2019 09:49 AM
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.
11-04-2019 09:59 AM
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
11-04-2019 10:27 AM
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.
11-04-2019 10:53 AM
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?
11-13-2019 09:02 AM
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.
11-13-2019 10:02 AM
Have you take a string of 2 characters and tried typecasting it to an I16?
11-13-2019 10:06 AM
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.
11-13-2019 11:49 AM
And please, how could i use that type? how to implement it to that Unflatten from String node.
11-14-2019 12:30 AM
@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.