From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary String and Binary Number to Decimal Number Conversion

Solved!
Go to solution

Hi everyone,

Would you please tell me how to convert this kind of string data (that is from spectrum analyzer) to numbers?  the picture is attached.

Many Thanks,

Marjan

 

0 Kudos
Message 1 of 10
(3,072 Views)

Hi Marjan,

 

please tell me how to convert this kind of string data (that is from spectrum analyzer) to numbers?

Simple answer: read the manual of your SpectrumAnalyzer to know how to convert that string…

 

the picture is attached.

You're kidding: you want help on string conversion with your VI - and all you attach is an image of its frontpanel?

It's like bringing a photo of your car to the repairshop when you want help with it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(3,064 Views)

Hi GerdW,

Thanks for your reply. 

In the user manual doesn't say anything for converting in the Labview!!

I just  wanted somebody tell me how to convert this kind of data and I thought no need to send the real data. If you think is better to have it as vi, here is attached.

 

Best regards,
Marjan
0 Kudos
Message 3 of 10
(3,049 Views)

Hi Samamiri,

 

In the user manual doesn't say anything for converting in the Labview!!

I don't expect that.

But I expect a clear description of how the data is encoded in this string. And you need to know that encoding to be able to decode the string!

 

You still wasn't able to name the exact type of your analyzer. You didn't tell us how you received that string (using which command and parameters)!

And the VI you attached is empty as you forgot to set some meaningful data as default value…

Best regards,
GerdW


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

OK, Thanks, I will find out how the data is encoded and then back to you.

0 Kudos
Message 5 of 10
(3,038 Views)

Hi,

I used a simple read and write vi which is attached, the Spectrum analyzer is Hantek, and there are two formats for output data:

ASCII : The data point is ASCII character, separated by comma. 
REAL: The data point is 32 bit binary number. 

Thanks

Marjan

0 Kudos
Message 6 of 10
(3,030 Views)
Solution
Accepted by topic author Samamiri

Strip off the first 11 ASCII characters.  Typecast the remaining to Single Floating Point

Message 7 of 10
(3,014 Views)

Hi,

Thank you very much for your suggestion. It seems it  work but when I plot the data it is slightly different from that one which shows by the spectrometer unit. You can see both the vi with the graph and the screen shot of the spectrum in the attachments. And also this result comes by real format and when I change it to the ASCII format that completely gives a different result. 

Thanks again

Download All
0 Kudos
Message 8 of 10
(3,005 Views)

Attached another file

0 Kudos
Message 9 of 10
(3,004 Views)

Hi,

Now it works perfectly and the graphs are matched, just I have changed some scales. Thanks for your help.

0 Kudos
Message 10 of 10
(2,988 Views)