function extract_q(fname)

infile  = [fname,'.dat'];
outfile = [fname,'.dat.q'];

if exist(infile) ~= 2
   error(['Input .dat file not found.'])
  end

if exist(outfile) ~= 0
   error(['Output data file already exists.'])
  end

flx = load(infile);

t = flx(:,1);
q = flx(:,10);

fid = fopen(outfile,'w');

for i=1:length(t)
  fprintf(fid,'%12.4f %12.4f\n',t(i),q(i));
 end

return
