File I/O and Digital Waveform Data

NI Digital Waveform Generator/Analyzer

File I/O and Digital Waveform Data

You will often store digital waveform data on a disk and use file I/O in your program to retrieve the data. A convenient file format for storing digital waveform data is the .hws file format. NI Hierarchical Waveform Storage (NI-HWS) provides a set of functions for easily and efficiently storing and retrieving digital waveform data files. NI-HWS works with binary data (U8, U16, and U32) and Waveform Data Type (WDT) data, as shown in the LabVIEW code snippets in the following figure:

Using File I/O with Digital Waveform Data

NI-HWS can convert some waveform data from the data type in which it was stored to a different data type when the data is read or retrieved. The table below shows the supported type conversions. A "Yes" in a box means that data stored as one data type can be retrieved as the other data type; a dash means the conversion is not supported.

Stored Type Retrieved Type
Digital
WDT
Digital
1D U8
Digital
2D U8
Digital
1D U16
Digital
2D U16
Digital
1D U32
Digital
2D U32
Digital
WDT
Yes
Digital
1D U8
Yes Yes Yes Yes Yes Yes Yes
Digital
2D U8
Yes Yes Yes Yes
Digital
1D U16
Yes Yes* Yes* Yes Yes Yes Yes
Digital
2D U16
Yes Yes* Yes Yes
Digital
1D U32
Yes Yes* Yes* Yes* Yes* Yes Yes
Digital
2D U32
Yes Yes* Yes* Yes
*For digital waveforms, smaller data types can read larger data types with the following restrictions: the data must be mapped and all mapped bits must be within the smaller data types range.

When digital data is retrieved as WDT, the Dynamic Channel List attribute is used to determine the number of channels of data that the digital WDT contains. When data is initially stored as WDT, this attribute is automatically set.

The NI Digital Waveform Editor (DWE) uses digital .hws files as its native file format for easy transfer of data between the DWE and your programming environment. The following figure illustrates the relationship between your programming environment, the DWE, and .hws files.