![](https://www.opentextbooks.org.hk/sites/opentextbooks/files/book_profile/cc_icon/by-sa.png)
The signal.dat file created in the previous example will be used to read data from a file. As in the previous example, select the File Dialog, Open/Create File, Read from Binary File and Close File functions.
![media/image19.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image19.png)
Create constants by right clicking on the operation (0:open) and access (0:read/write) terminals of the Open/Create File operation. Set the constants toopen andread-only respectively (see Figure Figure 11.20).
![media/image20.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image20.png)
Similar to creating arrays, drop an array constant in the G diagram, drop a numeric constant onto the array constant and set the data type representation to double. Wire this array constant to the data type terminal of the Read from Binary File function as shown in Figure Figure 11.21 .
![media/image21.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image21.png)
In the Front Panel window, drop a Waveform Graph.
![media/image22.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image22.png)
With the data type specified, wire thedata terminal of the Read from Binary File function to the Waveform Graph terminal as shown in Figure Figure 11.23 .
![media/image23.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image23.png)
Complete the program by wiring refnum and error terminals of the Open/Create File, Read from Binary File and Close File functions as shown in Figure Figure 11.24 .
![media/image24.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image24.png)
When this program is executed, a fle dialog box appears. Select the signal.dat file and click OK.
![media/image25.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image25.png)
The binary data in signal.dat is read and plotted in a Waveform Graph. The result is shown in Figure Figure 11.26.
![media/image26.png](http://www.opentextbooks.org.hk/system/files/resource/8/8091/8161/media/image26.png)
- 1262 reads