NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Active Participant
OnlyOne
Posts: 620
0 Kudos
Accepted Solution

How to convert comma-separated-string into numeric-array?

Hello,

my 34401 returns 200 values in a string with this format:

-1.42979706E-03,+4.46900451E-03,-8.48235088E-04,-2.17539596E-03,-1.34144462E-03,+4.50590958E-03,-9.78340028E-04,-2.31519575E-03,-1.10844497E-03,+4.70200416E-03,-9.83187455E-04,-2.45499555E-03.....

 

So the numbers are comma-separated and the doubles have a point.

 

How can i now move this values into a double-array?

 

Thanks for the help

Proven Zealot
GerdW
Posts: 9,178

Re: How to convert comma-separated-string into numeric-array?

[ Edited ]

Hi OnlyOne,

 

easy like this:

20223i6E806FBE09F9FDFD

Best regards,
GerdW


CLAD, using 2009SP1 + LV2011SP1 (sometimes even LV2013SP1) on WinXP+Win7+cRIO
Kudos are welcome :smileywink:
Active Participant
OnlyOne
Posts: 620
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Thx for the fast answer but its not working corectly.

 

The numbers are wrong converted:

 

For example a:

+2.93120677E-03 is converted to 2 instead of 0,00293120677

 

Whats wrong here?

 

Proven Zealot
GerdW
Posts: 9,178

Re: How to convert comma-separated-string into numeric-array?

[ Edited ]

Hi OnlyOne,

 

you should note that you configured your computer wrongly :smileywink: You use German/East Europe regional settings with "," as decimal separator and try to convert measurement data using "." instead...

 

Well, try a format string of "%.;%f" - and read the help for format strings!

 

When the different format string also fails, you may try this one:

20225iC85653BA6FBF7EF9

Best regards,
GerdW


CLAD, using 2009SP1 + LV2011SP1 (sometimes even LV2013SP1) on WinXP+Win7+cRIO
Kudos are welcome :smileywink:
Active Participant
OnlyOne
Posts: 620
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Thx for the solution. Both things are working.

 

Member
Yyad
Posts: 5
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Hello, 

 

I was working on similar project.  I got to separate two string number as (25 , 124) where first number is temp and second is pressure read from arduino device.  I need to separaye these two numbers and put it into graph as well as store the results in a file.  

My readings are as:

24,124

25,167

33,234

and so on...

i could separate using your vi but it puts both in array  .  I was trying to separate it out and put in graph .

 

I look forward for anyone's help.  If I could get he Vi or detail information on it, I would really appreciate it.  

Knight of NI
RavensFan
Posts: 15,609
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Use Index Array to get two different 1-D arrays of each column.

Member
Yyad
Posts: 5
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Thank you for the reply. To be honest i am new to this labview . If you could show any example Vi i would really be so thankful.
Knight of NI
RavensFan
Posts: 15,609
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Member
soulfulscientist
Posts: 2
0 Kudos

Re: How to convert comma-separated-string into numeric-array?

Thank you for this post. I had the reverse problem, converting a numeric array to comma separated list of strings.