LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read ASCII file


smercurio_fc wrote:

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.


That's the only way I know, too.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 11 of 28
(1,913 Views)

billko wrote:

smercurio_fc wrote:

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.


That's the only way I know, too.


 

That's maybe because you don't know the Open G tools Smiley Very Happy Smiley Very Happy Smiley Very Happy

They allow "ignore multiple delimiters" and that's the whole trick!!

 

See my solution on bottom page 1 Smiley Wink

0 Kudos
Message 12 of 28
(1,904 Views)

Alain S wrote:
That's maybe because you don't know the Open G tools Smiley Very Happy Smiley Very Happy Smiley Very Happy
They allow "ignore multiple delimiters" and that's the whole trick!!

 

See my solution on bottom page 1 Smiley Wink


That VI is not required, and doesn't really buy you anything. Also, the use of the Decimate 1D Array function means that you're hard-coding the number of columns.

 

Also, please note that the OP has LabVIEW 7, so they do not have the Read from Text File function.

0 Kudos
Message 13 of 28
(1,897 Views)

smercurio_fc wrote:

Also, the use of the Decimate 1D Array function means that you're hard-coding the number of columns.


 

Programming this : SNAG-034.jpgis also hard-coding the number of columns Smiley Wink

 

 


 smercurio_fc wrote:

Also, please note that the OP has LabVIEW 7, so they do not have the Read from Text File function.


Where did you get that idea? Can't read any reference to any LV version in this whole thread?

0 Kudos
Message 14 of 28
(1,882 Views)

Alain S wrote:

Programming this : SNAG-034.jpgis also hard-coding the number of columns Smiley Wink


That was for demonstration, and my comment in the block diagram explicitly says that this would be only useful if you know the fixed width and columns ahead of time. It was not meant to be used, but to be seen as a comparison to the second method I had shown, which is a more general approach.

 

 


Alain S wrote:

 


 smercurio_fc wrote:

Also, please note that the OP has LabVIEW 7, so they do not have the Read from Text File function.


Where did you get that idea? Can't read any reference to any LV version in this whole thread?


Just download the VIs the poster uploaded. You will see that they are in LV 7.1 Smiley Wink

 

0 Kudos
Message 15 of 28
(1,875 Views)

Alain S wrote:

 smercurio_fc wrote:

Also, please note that the OP has LabVIEW 7, so they do not have the Read from Text File function.


Where did you get that idea? Can't read any reference to any LV version in this whole thread?


From their VI.

 

When you open a VI and it has the changed asterisk in the title bar, you know something has changed just by opening it.  Usually because it was recompiled from an older version to the version you opened it in.  Do a VI properties and List Unsaved Changes and it will give you the details.  In this case it was saved in an older version of 7.1.  If you don't get changed asterisk, then they saved it in the same version you opened it in.  If you get an error about not being able to open it, it was saved in a newer version than you opened it in.

Message Edited by Ravens Fan on 08-14-2009 02:49 PM
Message 16 of 28
(1,872 Views)

Alain S wrote:

billko wrote:

smercurio_fc wrote:

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.


That's the only way I know, too.


 

That's maybe because you don't know the Open G tools Smiley Very Happy Smiley Very Happy Smiley Very Happy

They allow "ignore multiple delimiters" and that's the whole trick!!

 

See my solution on bottom page 1 Smiley Wink


Usually when I propose a solution, I try to make it as generic as possible so even if the user has only the basic install it will work.  But you are absolutely correct that I haven't been exposed to Open G tools, so I did not know this was an option.  Even so, I would've recommended the generic solution first, then the other solution as an advanced one.  😉

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 17 of 28
(1,847 Views)

Thanks for the advice.

 

I modified your program but an error message 85 occurs. See attached. Any hints?

 

0 Kudos
Message 18 of 28
(1,789 Views)

Even with the original vi one get an error Smiley Mad

That's why I looked for an error free solution Smiley Very Happy, that you can't use because of you're "older" LV version Smiley Sad

 

Anyway, just wire the "error out" connecter of the "scan from string" vi to the loop and connect an array of error clusters to the Auto-Indexed tunnel.

Now you won't have that pop up window anymore but still can see the errors in the error cluster array.

Since the file is processed correctly I wouldn't care too much Smiley Surprised

0 Kudos
Message 19 of 28
(1,785 Views)
That error comes from the blank line at the end 🙂
0 Kudos
Message 20 of 28
(1,782 Views)