LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in reading txt files

Solved!
Go to solution

I need to convert a txt file, with the columns separated by tab, into an array. While using the "Read from spreadsheet" function, the problem is one of the columns of the file has small numbers, such as 0.005257, and it seems like it round it to zero in reading. I've already tried to change the format to (%.8f), but it did not workout. Below a image with the problem:

 

 

reading files problems.jpg

0 Kudos
Message 1 of 3
(679 Views)

We always ask (politely, sometimes) that (new) Users post their VIs, not pictures of their VIs, so we can make sure we are answering the "real question".  So I'm going to "guess" and say that you haven't learned that an indicator (a Front Panel object that displays values) (and, for that matter, a "control", a Front Panel object where you enter values) have a "Display Property" that, among other things, sets "rounding", "precision", "# of digits displayed", whether in decimal, Scientific, Engineering, Hexadecimal, Octal, or maybe other formats ...

 

Open your VI and look at the Front Panel.  Right-click the item that you think has a non-zero element that is just "small", and displays "rounded to zero".  Look at its Properties, the Display Format tab.  If you need Help, press the Help button on the lower right of the Property window.

 

Does that fix your problem?

 

Bob Schor

0 Kudos
Message 2 of 3
(650 Views)
Solution
Accepted by topic author giovas_

Hi giovas,

 


@giovas_ wrote:

the problem is one of the columns of the file has small numbers, such as 0.005257, and it seems like it round it to zero in reading. I've already tried to change the format to (%.8f), but it did not workout.


This typically occurs when the computer is set to use a different decimal separator char than is used in the text file…

Is your computer set to use a comma as separator while the text contains numbers using the point (like "1,5" in your account settings, while "1.5" in the text file)?

 

Suggestions:

  • Use the formatstring %.;%f…
  • Change your computer (regional) settings to use the point as decimal separator…
Best regards,
GerdW


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