LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read from a text file

I have a long chain of binary numbers in a text file as attached.
 
I wanna read each column out to an array  and for each column I need convert every 32bit into a U32 number.
 
I wrote a VI but the vi can only read the first column and I also think there might be a better way to do the converting , any good idea?
 
Thanks a lot.
Download All
0 Kudos
Message 1 of 8
(3,675 Views)
Could you attach a real sample text file?
0 Kudos
Message 2 of 8
(3,669 Views)
sorry
 
here is the real txt file. I need the first 4 columns.
 
Thanks .
 
0 Kudos
Message 3 of 8
(3,643 Views)
If I understand the problem correctly, this should be one solution.  See Attached LV7.1.1 example

Paul
Message 4 of 8
(3,626 Views)

Pana-man

Thanks a lot .

by the way how do you convert the Hex to Dec ?

0 Kudos
Message 5 of 8
(3,618 Views)
With the finger pointing tool, click on the x (Radix) and select decimal.  No extra conversion need be accomplished.

Paul
Message 6 of 8
(3,614 Views)
Yesterday I made a quick draft, waiting for the data file. It is slightly different to Pauls but seems to give the same result. 🙂
 
You pick 😉
 
(btw: It might be much more efficient to read the file as string and parse it directly as U8. There is no need to allocate  4 bytes for each bit in the SGL array.)

Message Edited by altenbach on 11-22-2005 12:03 PM

0 Kudos
Message 7 of 8
(3,609 Views)


@altenbach wrote:
(btw: It might be much more efficient to read the file as string and parse it directly as U8. There is no need to allocate  4 bytes for each bit in the SGL array.)


Here's a quick modification of my example that only reads the first four numbers on each line and converts them directly to a boolean array. 😄
 
0 Kudos
Message 8 of 8
(3,599 Views)