08-12-2009 09:48 AM
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.
08-12-2009 09:52 AM
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.
08-12-2009 10:13 AM
08-12-2009 10:50 AM
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
08-13-2009 01:27 AM
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.
08-13-2009 03:48 AM
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 😉
08-14-2009 11:27 AM
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.
08-14-2009 12:07 PM
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
08-14-2009 12:09 PM
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.
08-14-2009 12:16 PM
This way the file is read correctly
But you'll need the Open G vi "String to 1D Array".