clear r
clear date
clear time
clear ap
clear timeStamp

%Parse the winch motor string
fprintf(1,'Parsing Winch Motor String\n');
r = epwm;
[date,r] = strtok(r);
[time,r] = strtok(r);
[ampm,r] = strtok(r);
temp = char(ampm);
ampm2 = temp(:,1:2);
b = blanks(length(date))';
temp = [char(date) b char(time) ampm2]; 
wmTimeStamp = datenum(temp);

[t,r] = strtok(r,',');
[temp,r] = strtok(r,',');
wmRCurrent = str2num(char(temp));
[temp,r] = strtok(r,',');
wmACurrent = str2num(char(temp));
[temp,r] = strtok(r,',');
wmPosition = str2num(char(temp));
[temp,r] = strtok(r,',');
wmVelocity = str2num(char(temp));
[temp,r] = strtok(r,',');
wmPError = str2num(char(temp));
[temp,r] = strtok(r,',');
wmVError = str2num(char(temp));
[temp,r] = strtok(r,',');
wmTemperature = str2num(char(temp));

%Parse the levelwind motor string
fprintf(1,'Parsing Levelwind Motor String\n');
r = eplw;
[date,r] = strtok(r);
[time,r] = strtok(r);
[ampm,r] = strtok(r);
temp = char(ampm);
ampm2 = temp(:,1:2);
b = blanks(length(date))';
lwTimeStamp = [char(date) b char(time) ampm2]; 

[t,r] = strtok(r,',');
[temp,r] = strtok(r,',');
lwRCurrent = str2num(char(temp));
[temp,r] = strtok(r,',');
lwACurrent = str2num(char(temp));
[temp,r] = strtok(r,',');
lwPosition = str2num(char(temp));
[temp,r] = strtok(r,',');
lwVelocity = str2num(char(temp));
[temp,r] = strtok(r,',');
lwPError = str2num(char(temp));
[temp,r] = strtok(r,',');
lwVError = str2num(char(temp));
[temp,r] = strtok(r,',');
lwTemperature = str2num(char(temp));

%Parse the Accel Pressure string
fprintf(1,'Parsing Acceleration/Pressure String\n');
r = epad;
[date,r] = strtok(r);
[time,r] = strtok(r);
[ampm,r] = strtok(r);
temp = char(ampm);
ampm2 = temp(:,1:2);
b = blanks(length(date))';
adTimeStamp = [char(date) b char(time) ampm2]; 

[t,r] = strtok(r,',');
[temp,r] = strtok(r,',');
adAx = str2num(char(temp));
[temp,r] = strtok(r,',');
adAy = str2num(char(temp));
[temp,r] = strtok(r,',');
adAz = str2num(char(temp));
[temp,r] = strtok(r,',');
adARatex = str2num(char(temp));
[temp,r] = strtok(r,',');
adARatey = str2num(char(temp));
[temp,r] = strtok(r,',');
adARatez = str2num(char(temp));
[temp,r] = strtok(r,',');
adDepth = str2num(char(temp));

%Parse the Labjack string
fprintf(1,'Parsing Labjack String\n');
r = eplj;
[date,r] = strtok(r);
[time,r] = strtok(r);
[ampm,r] = strtok(r);
temp = char(ampm);
ampm2 = temp(:,1:2);
b = blanks(length(date))';
ljTimeStamp = [char(date) b char(time) ampm2]; 

[t,r] = strtok(r,',');
[temp,r] = strtok(r,',');
ljReqWinchRPM = str2num(char(temp));
[temp,r] = strtok(r,',');
ljLWBaseDACVoltage = str2num(char(temp));
[temp,r] = strtok(r,',');
ljWinchDACVoltage = str2num(char(temp));
[temp,r] = strtok(r,',');
ljLWDACVoltage = str2num(char(temp));
[temp,r] = strtok(r,',');
ljMotorTension = str2num(char(temp));
[temp,r] = strtok(r,',');
ljFlangeTension = str2num(char(temp));
[temp,r] = strtok(r,',');
ljTotalTension = str2num(char(temp));
[temp,r] = strtok(r,',');
ljBusVoltage = str2num(char(temp));
[temp,r] = strtok(r,',');
ljLWError = str2num(char(temp));
[temp,r] = strtok(r,',');
ljWinchCPS = str2num(char(temp));
[temp,r] = strtok(r,',');
ljLWDirection = str2num(char(temp));
[temp,r] = strtok(r,',');
ljEOTLeft = str2num(char(temp));
[temp,r] = strtok(r,',');
ljEOTRight = str2num(char(temp));
[temp,r] = strtok(r,',');
ljCableLeft = str2num(char(temp));
[temp,r] = strtok(r,',');
ljCableRight = str2num(char(temp));



