function [local_ev_log] = save_event_log_mpi(i_mainloop, ev_log_num, perm_event_log, output_dir, output_filename, code_dir)

% local_ev_log = [];

ev_log_name = ['eventlog_' num2str(i_mainloop) '_' num2str(ev_log_num)];

eval([ev_log_name, ' = perm_event_log;'])   % give my perm log a variable name

% m = size(perm_event_log,1); % How many rows?

%local_ev_log([1:m],:) = perm_event_log;  % Fill rows with ev_log_num

local_ev_log = struct(ev_log_name, perm_event_log);

disp(local_ev_log);
