function save_logdata(varargin)

% will create a binary file with name batch_name_eventlog
% containing eventlog_data
% 1st argument = output directory (with full path)
% 2nd argument = batch name, from output_filename in default_directories.m
% 3rd argument = 'eventlog'
% 4th argument = run_id
% 5th argument = eventlog_id 
% 6th  = eventlog_data to save
%                  Slava Chushak               02/07

mat_name = [varargin{2} '_' varargin{3} '_' num2str(varargin{4})];
mat_name = [mat_name '_' num2str(varargin{5})];

output_file = fullfile(varargin{1},mat_name);

fid = fopen(output_file,'wb');
data = varargin{6};
fwrite(fid, data(:,1), 'real*8');
fwrite(fid, data(:,2), 'real*8');
fclose(fid);
