Reading Data from ACQUIRE

Starting Up

The following two commands prevent annoying warnings about the use of symbols similar to those used by Mathematica because Mathematica will not let us change their definitions.

Off[General::spell]; Off[General::spell1];

Use SetDirectory to choose the directory where your data file is located.

\(\(\(
\)\(SetDirectory["C:\Mathematica\phys375"];\)\)\)

Read ACQUIRE Output Data Files

To read a sequential data file into Mathematica use ReadList. The output files generated by Acquire consist of a header line followed by data in three-column format. The first column is the time; the second column is the data for channel 1; and the third column is the data for channel 2. The commands  below clear the variables to be used, open the file, skip the header line, and then read the data. The option RecordLists->True puts objects on separate lines into separate sublists.

Clear[in, datafile];
in = OpenRead["mydata.dat"];   
Skip[in, String];   
datafile = 
        ReadList[in, Number, RecordLists -> True];

Rearranging the data

The first command unpacks the data file into three vectors, time, channel 0, and channel 1. Then the next commands generate the data pairs.

{time, channel0, channel1} = Transpose[datafile];
adata0 = Transpose[{time, channel0}];
adata1 = Transpose[{time, channel1}];

Plotting your data

You can check your data with a plot:

ListPlot[adata1];