> Hi. > > I'm using LV5.1. > > I want to read data from ASCII file made from FORTRAN program. > > The data file consists of 5 colums and several rows like below. > > 0.0000000E+00 0.0000000E+00 1.587401 2.6070468E-02 0.3855242 > 3.9999999E-02 0.3121254 1.342645 2.2050731E-02 0.3493916 > 7.9999998E-02 0.6242507 1.049508 1.7236449E-02 0.2965122 > 0.1200000 0.9363760 0.7434418 1.2209801E-02 0.2283728 > 0.1600000 1.248501 0.4503268 7.3958868E-03 0.1477234 > 0.2000000 1.560627 0.1815041 2.9809121E-03 5.8283314E-02 > 0.2400000 1.872752 -6.6547669E-02 -1.0929269E-03 -3.5646241E-02 > 0.2800000 2.184877 -0.3079535 -5.0576325E-03 -0 .1296009 > ................................ > > I'm a novice in using LV, so I want to get some sample program. > > Thank you for reading this article. > > mail to : hhlee@hhi.co.kr
Here you go:
This is the front panel of the small program after running it: it contains a file path to your data file and a 2d-array indicator with the data read
[Image]
this is the diagram ('source code') of the program: it uses a .vi 'Read from spreadsheet file.vi' delivered with the labview system (it is the second entry in the 'Functions->File I/O' menu) it reads ASCII data and converts to single precision binary values (SGL).
[Image]
the only special thing to note here is the format specifier "%.;%g": the %.; defines period as decimal separator (my PC uses comma as default, so I had to use this) and the %g is the conversion code for any engineering format.
Sorry, I forgot to mention, that the 'Read from spreadsheet file.vi' assumes a tab as column delimiter. If another char is used, this has to be wired to the 'Read from spreadsheet file.vi ' icon