Filename_Channel = input('Channel File Name: = ','s');
Filename_Parameters = input('Parameters File Name: = ','s');
load(Filename_Channel);
load(Filename_Parameters);
struct2var(Code_Parameters);
struct2var(Channel_Parameters_Bad);
struct2var(Channel_Parameters_Good);
Filename_Data_1 = input('Data File Name (1): = ','s');
load(Filename_Data_1)
Code_Losses_Bad_Array_1 = cell2mat(struct2cell(Code_Losses_Bad.'))./(Channel_Parameters_Bad.Long_Channel_Length/M);
Code_Losses_Good_Array_1 = cell2mat(struct2cell(Code_Losses_Good.'))./(Channel_Parameters_Good.Long_Channel_Length/M);
Code_Losses_Array_1 = Code_Losses_Bad_Array_1 + Code_Losses_Good_Array_1;
Filename_Data_2 = input('Data File Name (2): = ','s');
load(Filename_Data_2)
Code_Losses_Bad_Array_2 = cell2mat(struct2cell(Code_Losses_Bad.'))./(Channel_Parameters_Bad.Long_Channel_Length/M);
Code_Losses_Good_Array_2 = cell2mat(struct2cell(Code_Losses_Good.'))./(Channel_Parameters_Good.Long_Channel_Length/M);
Code_Losses_Array_2 = Code_Losses_Bad_Array_2 + Code_Losses_Good_Array_2;

Code_Losses_Bad_Array = (Code_Losses_Bad_Array_1 + Code_Losses_Bad_Array_2)./2;
Code_Losses_Good_Array = (Code_Losses_Good_Array_1 + Code_Losses_Good_Array_2)./2;
Code_Losses_Array = (Code_Losses_Array_1 + Code_Losses_Array_2)./2;
save([Filename_Data_1 '_All'],'Code_Losses_Bad_Array','Code_Losses_Good_Array','Code_Losses_Array')

%% Plotting
LineWidth = 3;
figure
semilogy(PeGs,Code_Losses_Array,'o-','LineWidth',LineWidth)
grid on
legend('Uncoded','Optimal Code','Optimal Robust Code','MDP','SCo','SCo (MDP)')
xlabel('\epsilon')
ylabel('P_{Loss}')
%title(Channel_Title)