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: 

read from spreadsheet file

Solved!
Go to solution

Hello,


I would just like some help with my code. I'm trying to read data from "WAV00000.CSV", but I have a problem with the precision of numbers.

Example:

-9.980000E-3 was read as -9,000

How can I solve this problem?

 

Regards

 

Download All
0 Kudos
Message 1 of 8
(3,322 Views)

sljuka wrote:

How can I do that?


Do what? You are not saying what the problem is, but your code seems to work just fine.

 

(Of course it cannot read the header and thus substitutes zeroes, but you could read the first line seperately, then set the offset accordingly before reading the spreadsheet data. You could also simply delete the first row.)

0 Kudos
Message 2 of 8
(3,320 Views)

Ah, OK you edited your question.

 

Could it be you are using a OS version where the decimal point is a comma? This is basically incompatible with CSV, because you cannot have a comma as decimal seperator and column delimiter at the same time. Your OS does not recognize the period as decimal seperator, and thus truncates the data.

 

Try a format of "%.;%3e" (percent-period-semicolon-percent-three-e). I cannot test, but it's worth a shot. The "%.;" should force treating the period as decimal point. Check the help.

0 Kudos
Message 3 of 8
(3,311 Views)

Hi,

 

You should read the rows as string then you can convert Engineering style values to double format number by "Fract/Exp String To Number" function.

I attached the example.

 

Regards,

Peter

Peter Vago
0 Kudos
Message 4 of 8
(3,267 Views)

You probably have a Labview 2010 and I can not open your example. I have Labview 2009. Can you save this example for my version of Labview?

Regards,

0 Kudos
Message 5 of 8
(3,251 Views)

The example posted above is pointless, because your problem has to do with the localized decimal point. (Your program works just fine in the USA).

 

Have you tried my suggestion with the format modification? Did it work?

0 Kudos
Message 6 of 8
(3,239 Views)
Solution
Accepted by topic author sljuka

in 2009


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(3,238 Views)

I tried but it didn't work (I don't know why). This last example is OK.

 

Thanks!

 

0 Kudos
Message 8 of 8
(3,215 Views)