function Dc = loadpresscalfile( fn, Dc_type ) % LOADDPRESSCALFILE - Reads Sontek pressure sensor calibration data % Dc = loadpresscalfile( fn, Dc_type ) % % Input: fn - file name of calibration file % Dc_type - either 'paros' or 'druck' % % Output: Dc - struture of calibration info % % Note that, despite the name that follows Sontek practice, % this also loads Paros frequency calibration data. % % Based on Sontek advdata.c, ADF_SOFT_VER 7.70 % Chris Sherwood % August 9, 2001 fid = fopen(fn,'r'); Dc.sernum = fgetl(fid); [coeff,count]=fscanf(fid,'%g'); if(count ~= 30 ),error('Cant read calfile.');,end fclose(fid); if(strcmpi(Dc_type,'paros')), Dc.caltype = 'paros'; Dc.F0=coeff(1); Dc.U0=coeff(2); Dc.dum=coeff(3:6); Dc.Y=coeff(7:10); Dc.C=coeff(11:14); Dc.D=coeff(15:18); Dc.T=coeff(19:30); elseif(strcmpi(Dc_type,'druck')), Dc.caltype = 'druck'; Dc.F0=coeff(1); Dc.X =coeff(2); Dc.Y=coeff(3); Dc.T0=coeff(4); Dc.D0=coeff(5); Dc.DTslope=coeff(6); k=6; Dc.K = zeros(6,4); for i=1:6, for j=1:4, k=k+1; Dc.K(i,j)=coeff(k); end end else error('Dc_type must be druck or paros (in single quotes)'); end