function [infiniumparam]=ReadInfiniumCSVFile(filename1);
fid1=fopen(filename1,'r');

%read header lines in one at a time, convert param types, store in output structure.
data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.type = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.points = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.count = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xinc = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xorg = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xref = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.ydatarange = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.ydatacenter = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.coupling = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xrange = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xoffset = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.yrange = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.yoffset = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.date = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.time = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.frame = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.acqmode = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.completion = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.xunits = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.yunits = data(16:n);

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.maxbandwidth = str2double(data(16:n));

data=fgetl(fid1);
[m,n]=size(data);
infiniumparam.minbandwidth = str2double(data(16:n));

data=fgetl(fid1);
data=[];  %Discard Data Header Info

% Read Data in one line at a time and store in output structure.

infiniumparam.x=zeros(infiniumparam.points,1);
infiniumparam.y=zeros(infiniumparam.points,1);
for k=1:infiniumparam.points,
   data=fgetl(fid1);
   [m,n]=size(data);
   l=find(data==',');   
	infiniumparam.x(k) = str2double(data(1:l-1));
   infiniumparam.y(k) = str2double(data(l+1:n));
end;
pts=infiniumparam.points;
if pts~=(2*floor(pts/2)),
   infiniumparam.points=pts-1;
   infiniumparam.x=infiniumparam.x(1:infiniumparam.points);
   infiniumparam.y=infiniumparam.y(1:infiniumparam.points);
   disp('Input Data Truncated To Even Number of Points')
end;

fclose(fid1);
