LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while reading a *.dat file

Hi Labview community, I feel stupid this question but the truth is that i can not find a way araund, so:

How can you a read a file that have blank spaces in front:

Example
----------0.5785
----------0.5878
(the ---- try to simulate blank spaces)

If I remove until zero, and i transform the data to
5.785
5.878

it just read the 5 using %.3f   . The documentation about string formating is terrible I have not been able to find anything decent.

If anything knows about it, it would be very helpful, thanks in advance.


0 Kudos
Message 1 of 9
(3,598 Views)
The Scan From String with a format of %.3f will convert ----0.5785 to 0.5785 no matter how many spaces you have in front of the number and if you have the text 5.785 it will convert to the number 5.785. Are you sure that your numberic indicator is a double or single and not an interger? If it is, why don't you post your VI and a sample of the file you're trying to read?
0 Kudos
Message 2 of 9
(3,591 Views)
Thanks, so is not my going nuts, it should work!

Here is the *.vi, more stripped down impossible.
Also the file.

I reeeaaaally would appreacite a hand.

Thanks!

Download All
0 Kudos
Message 3 of 9
(3,588 Views)
I can read the file just fine. The 1D array has 0.0, .724, .729,....796,.798.
0 Kudos
Message 4 of 9
(3,586 Views)
AAAggghhhhhh! Don't tell me that! I have spend the last three ours with this bloody thing (sorry for the language)!

OK.... I am just going to re-start the computer, before shot myself!

0 Kudos
Message 5 of 9
(3,583 Views)
Still does not work in my computer.
I don't understand what's going on. I have been programming with Labview for the last three years!
I will try to re-install Labview as a last resource...

I need to admit that never before I have been so close to hit the screen as this evening!

Anyway, thanks for the replays Dennis.

PD: If anybody has a clue why my labview does not like a number that starts with 0, I kiss the screen!

Good weekend.


0 Kudos
Message 6 of 9
(3,577 Views)

Just in case wants to know, the problem was that my data file was using a dot to separate the decimas 0.58, and Labview didn't like it. by just changing the input to 0,58 everything was fine.
All the best, Jofre.

0 Kudos
Message 7 of 9
(3,566 Views)
Interesting.  In the future, you may want to look under help for "Format Specifiers Syntax Elements."  At the bottom, there is a section titled "Localization Codes" which will help you define how LV interprets the decimal separator.  For example, to use the period decimal point, the code is %.; while for a comma, it is %.;
Just FYI.
0 Kudos
Message 8 of 9
(3,558 Views)
Which explains why it ran perfectly on my (US) version of LabVIEW.
0 Kudos
Message 9 of 9
(3,544 Views)