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.
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).
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 .
In the Front Panel window, drop a Waveform Graph.
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 .
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 .
When this program is executed, a fle dialog box appears. Select the signal.dat file and click OK.
The binary data in signal.dat is read and plotted in a Waveform Graph. The result is shown in Figure Figure 11.26.