function [ws1,ws2,ws3,ws4,errS] = read_DH4_wetstar(s1)

global dataS
% data acquisition script for analog wet stars connected to a WET Labs DH4
% fluorometer intercalibration for CANON
% Luke Beatman; September, 2010

%global data str
%OK = 1;
%byts = 0;
errS = '';
% if s.bytesavailable > 0
%   junkstr = fread(s,s.bytesavailable);
% end
%flushinput(s)
%while 1
try
  outdat = fread(s1,500);
  outdatS = num2str(outdat');
  i4header = findstr('8    8',outdatS);
  i4ender = findstr('####',outdatS);
  if length(i4header) < 2
    disp('Not a full message')
    return
  else
  dataS = outdatS(i4header(1):i4header(2)-1);
  alldat = str2num(dataS);
  dfg = char(alldat);
  i4ender = findstr('####',dfg);
  fluordat = str2num(dfg(i4ender-31:i4ender-1));
  ws1 = fluordat(2);
  ws2 = fluordat(3);
  ws3 = fluordat(4);
  ws4 = fluordat(5);
  errS = '';
  end
catch
  ws1 = NaN;
  ws2 = NaN;
  ws3 = NaN;
  ws4 = NaN;
  errS = strpad_(['SBE45:' lasterr],100);
  return
end
%end
