LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ascii string into array of decimal numbers

Hi, I am trying to convert an ASCII string into an array of decimal numbers but i was unsuccessful storing all the numbers into the array.

Can anyone help?

I am attaching the vi + the .dat file

 

Thanks,

Christos

 

 

Download All
0 Kudos
Message 1 of 10
(9,190 Views)

Hi Christos,

 

what you are doing is far to comlicated. You can just use an indexed tunnel on the for-loop. See my vi (or screenshot).

 

I hope that helps, RMathews 

Ramona Lombardo
Applications Engineer, NI Germany
Certified LabVIEW Developer
Message 2 of 10
(9,174 Views)

Even that is more complicated than it needs to be. Smiley Wink

 

Use either

(a) the Spreadsheet String to Array function

(b) Read From Spreadsheet File (and then simply peel off the first column). 

 

P.S. Eliminate the sequence structure - it's unnecessary. 

Message Edited by smercurio_fc on 08-27-2008 09:48 AM
Message 3 of 10
(9,170 Views)
Message 4 of 10
(9,163 Views)

Hi Christos,

see the picture please.  Smiley Wink

 

 

 

Mike 

Message Edited by MikeS81 on 08-27-2008 05:06 PM
Message 5 of 10
(9,155 Views)

Christos,

 

Are you trying to convert the individual characters from ASCII to decimal numbers?

 

For example your first line "40234" to 52, 48, 50, 51, 52.  In this way ending up with a 2D array.

 

Regards,  -SS

Message Edited by ShotSimon on 08-27-2008 10:31 AM


Message 6 of 10
(9,142 Views)

Here is my solution either way.  -SS

 

Message Edited by ShotSimon on 08-27-2008 11:19 AM


Download All
Message 7 of 10
(9,119 Views)

Hi,

 

I'm taking measurements with home-made instrument and collect data from it using labview but it is not in decimal numbers. It could be Ascii or hex and I tried many conversions but couldn't get it right. I attached the data file. I'd appreciate it if anyone could help me with that.

 

thanks

sbz

0 Kudos
Message 8 of 10
(8,316 Views)

Hi sbz,

 

it would really help when you could also show an expected result from your mangled data file. It seems to contain a lot of (short) lines with just 3 bytes per line, but randomly there's a TAB inbetween...

 

So do you have any idea what those 3 byte entities represent?

Best regards,
GerdW


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

Hi Sbz,

 

You said that you are reading from a home made instrument, is that right? If so, what values where you sending. If you was just sending from a microcontroller decimal values of a reading for example then when you read this on your computer it will be presented as ascii. If you want to convert the ascii to decimal values use the 'String to byte Array' function:

 

String to byte.png

 

As was mentioned by your other response, it appears that you are sending 3 bytes at a time followed by a new line charector? if so you will either have to get rid of the newline charector as you recieve the bytes, ie read bytes until newline charector, ignore but send bytes to buffer for processing. Or get rid of them somehow during post-processing.

 

If you could give us more information on what data you are actually sending then we would be in a better position to help.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 10 of 10
(8,247 Views)