Front Matter

Off[General::spell, General::spell1]

SetDirectory["D:\Teaching\PHYS405\Lectures"]

2D Plot

Read Data

filename = "test2.txt";
inunit = OpenRead[filename];
header = Read[inunit, String];
data = 
        ReadList[inunit, Number, RecordLists -> True];
Close[inunit];
header
data[[1]]
data[[2]]

Extract Plot Labels

label1 = StringTake[header, {2, 5}]
label2 = StringTake[header, -7]

Plot Data

ListPlot[data, Frame -> True, Axes -> False, 
      FrameLabel -> {label1, label2}]

3D Plot

Read Data

filename = "test.txt";
inunit = OpenRead[filename];
header = Read[inunit, String];
data = 
        ReadList[inunit, Number, RecordLists -> True];
Close[inunit];
header
data[[1 ]]
data[[2]]

Extract Plot Labels

StringLength[header]
label1 = StringTake[header, 10]
label2 = StringTake[header, {12, 20}]
label3  =  StringTake[header, -9]

Note, we skipped position 11 and 21.  This is because these positions contain 
the tabs that separate the data.

Plot Data

ListPlot3D[data, AxesLabel -> {label1, label2, label3}]

Here is how you can take just the Time and Ch 0.

subdata = Partition[Flatten[data], 2, 3];
subdata[[1]]
subdata[[2]]

ListPlot[subdata, Frame -> True, Axes -> False, 
      FrameLabel -> {label1, label2}]

Here is a way to take the time and Ch 1, i.e., skip Ch 0.

Partition[Flatten[data], 2, 3, {2, 3}];
subdata = Map[Reverse, %];
subdata[[1]]
subdata[[2]]

ListPlot[subdata, Frame -> True, Axes -> False, 
      FrameLabel -> {label3, label1}]