
function [data,header,freq,specrad,bt] = readall(file);
% function [data,header,freq,specrad,bt] = readall(file);
%       header is a matrix of all the headers (1 header per row)
%       specrad is a matrix of all the spectra (1 per row)

fid = fopen(file);
data = fread(fid,[2150, inf],'float32');
nspec=size(data);
nspec=nspec(2);
data = data';
header = data(1:nspec,1:100);
specrad = data(1:nspec,101:2148);

% Create frequency scale.
pts = header(1,31);
dnu = header(1,33);
low = header(1,34);
high = header(1,35);
freq = (low:dnu:high)';
freq = freq(1:2048);


bt = specrad*0;
for i = 1:nspec
	bt(i,:) = radtot(freq',specrad(i,:)/1E3);	
end

