LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read part of file?

I acquire and write data to file in binary format (I use "Write to SGL
file.vi"). This file is very long. Is there a way to read only part of
this file (for example from 5th to 7th minute). I wont to make X-Y
graph. If I use all file then the picture is illegible.
Thanks,
Darek
0 Kudos
Message 1 of 3
(2,919 Views)
If you want to read a part, use offset and data count included in SGL read vi, if you want to read all the file and plot only a part, just subset your array of data and the wire it to the XY graph.
Hope this helps
0 Kudos
Message 2 of 3
(2,919 Views)
You need to perform random access File I/O to retrieve only parts of your
file. This cannot be done with the Easy File I/O VIs. Instead you must use
the intermediate File VIs. Use the Open/Create/Replace VI to open your
file, and the Read VI to read the values you want. Then wire to the Close
VI, and finally the Simple Error Handler. On the Read VI, you need to at
least wire the following terminals:

Position Offset
Count
Byte Stream Type
Data
Error Cluster
refnum

The position offset is a value indicating how many samples from the start of
the file. You need to multiply the offset by 4 before connecting the value
to the Position Offset terminal because each SGL value is 4 bytes long. The
Count is how many values to read from the file. Wire up a SGL constan
t
(value doesn't matter, you only need the data type) to the Byte Stream Type
input. Wire the Data output terminal to the rest of your VI.

Keep in mind that if you want to track the point where data was last read,
you also need to wire the Pos Mode input.

Mike
0 Kudos
Message 3 of 3
(2,919 Views)