%function [beads] = load_bead_file(fn, num_sets)
function [beads] = load_data_file(fn, num_sets)

num_cols = num_sets + 6;

disp(['Loading file ' fn]);
fid = fopen(fn);

%1st element is num of cols
%num_cols = uint16(fread(fid, 1, 'uint16')); 
disp([num2str(double(num_cols)) ' columns of data.']);

data_col_vector = uint16(fread(fid, inf, 'uint16'));

%btl = 500000;
%data_col_vector = uint16(fread(fid, num_cols*btl, 'uint16'));

disp('Re-shaping data into return matrix.');
beads_temp = reshape(data_col_vector, num_cols, [])';
beads = [beads_temp(:,1:5) beads_temp(:,end) beads_temp(:,6:end-1)];
					    
st = fclose(fid);
					  
