function out = read_ic(ic_fname)

% basic function written to read in .ic files into a structure

fid = fopen(ic_fname); %open the ic file
fgetl(fid); fgetl(fid);  %skip the first 2 lines
icfile_raw.nm_ctr_wdt = cell2mat(textscan(fgetl(fid), '%f%f%*[^\n]')); %center wavenumber and width of window
icfile_raw.header = textscan(fgetl(fid), '%s'); %unspecified/unknown number of columns for headers.
icfile_raw.header = icfile_raw.header{1}; 
icfile_raw.data = textscan(fid, ['%s', repmat('%f', 1, length(icfile_raw.header)-1), '\n']); %read in the rest of the file
for i1=1:length(icfile_raw.header); %split remaining data into a structure
    icfile_raw.(icfile_raw.header{i1}) = icfile_raw.data{i1};
end
fclose(fid);

out = icfile_raw; %file output



