LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read ASCII file

I have a problem to read ASCII file (which contain waveform) in LabVIEW. The data in my ASCII file is separated by space only and without delimiter. When I read the file with 'Read from spreadsheet file', only the first row is read but the rest disappear.

 

The file is actually readable in excel, when fixed width is designated. I can upload the ASCII file, if needed.

0 Kudos
Message 1 of 28
(8,632 Views)

You would obviously need to set the delimiter as a space when using Read From Spreadsheet so if that did not work, please attach the text file so someone can see why.

 

If setting the delimiter to a space was not so obvious to you, try doing that.

0 Kudos
Message 2 of 28
(8,626 Views)
Here is the attached ASCII and simple vi files. Thanks.
Download All
0 Kudos
Message 3 of 28
(8,610 Views)

Your data is fine. Hope you learn some. Remember it is OK to look under the hood of Labview functions. Just use "save as" then saving the the modification

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 28
(8,597 Views)

Thanks. I tried but the output format is not what I want. My wanted format can be seen in the attached Excel spreadsheet file (data plotted in column), which shows a waveform from the 1st to the 255th column.

 

Thanks.

0 Kudos
Message 5 of 28
(8,565 Views)

Your data looks Ok to me. So I guess with the proper programming you should be able to extract your data. Often that is needed is just to transpose the output array.

Good Luck 😉



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 28
(8,548 Views)

It is of course okay when you view it as 1D. But what I need is to separate the 1D waveform into 2D because the data was collected in a 2D data collection mode.

 

I wrote a simple program to read the ASCII data. The 2D plot seems okay with the first glance, but the early part of the 1D waveform does not look good, bcause some data is chirped due to the delimiter in the subvi. The source data and the vi are attached. Have way to improve it? Thanks.

Download All
0 Kudos
Message 7 of 28
(8,490 Views)

Your problem is the "4 spaces" constant as a delimiter!

With some data there are no 4 spaces between numbers!

 

Looking with Excel to your data I see around row 33 following numbers

-72, -497, -1084, -1571, -2032, -1803, -839, 138, 1816 while your code returns

-72, -497, 0, 0, 0, 0, -839, 138, 1816 

 

So you have to read and process the file in another way Smiley Surprised

Message 8 of 28
(8,473 Views)

Since you have fixed-width files then you can't use the standard Read From Spreadsheet File VI since your delimiter will change depending on the number in the column. Your best bet is to read the file in as lines and then parse each line. In LabVIEW 8.x this is quite easy to do. In LabVIEW 7.1 you need two steps. See attached as a starting point.

 

I did not understand what you were saying about viewing the data as 1D and 2D collection mode.

Message 9 of 28
(8,471 Views)

This way the file is read correctly Smiley Surprised

 

SNAG-033.jpg 

 

But you'll need the Open G vi "String to 1D Array".

0 Kudos
Message 10 of 28
(8,463 Views)