function results = result_calculation(results,txObj,rxObj,i_snr,i_loop,n_frames)

results.err_PSDU(i_loop,i_snr) = sum(xor(txObj.output.PSDU,rxObj.output.PSDU)); 
results.num_PSDU(i_loop,i_snr) = numel(txObj.output.PSDU);

results.err_PSDU_plus_service(i_loop,i_snr) = sum(xor(txObj.output.PSDU_plus_service,rxObj.output.PSDU_plus_service)); 
results.num_PSDU_plus_service(i_loop,i_snr) = numel(txObj.output.PSDU_plus_service);

results.err_coded_data(i_loop,i_snr) = sum(xor(txObj.output.coded_data(:,1),rxObj.output.coded_data(:,1))); 
results.num_coded_data(i_loop,i_snr) = numel(txObj.output.coded_data);

results.err_uncoded_data(i_loop,i_snr) = sum(xor(txObj.output.uncoded_data(:,1),rxObj.output.uncoded_data(:,1)));
results.num_uncoded_data(i_loop,i_snr) = numel(txObj.output.uncoded_data);

results.err_frames_PSDU(i_loop,i_snr) = sum(xor(txObj.output.PSDU,rxObj.output.PSDU)) ~= 0;
results.num_frames_PSDU(1,i_snr) = n_frames;

results.err_frames_coded_data(i_loop,i_snr) = sum(xor(txObj.output.coded_data(:,1),rxObj.output.coded_data(:,1))) ~= 0;
results.num_frames_coded_data(1,i_snr) = n_frames;

%Test srablerouin/out
results.err_scrambler(i_loop,i_snr) = sum(xor(txObj.output.scramblerOut,rxObj.output.descramblerIn));
results.num_scrambler(i_loop,i_snr) = numel(txObj.output.scramblerOut);

%Test channel

results.err_scrambler(i_loop,i_snr) = sum(xor(logical(round(real(txObj.output.x_s(:,1)))),logical(round(real(rxObj.output.chan(:,1))))));
results.num_scrambler(i_loop,i_snr) = numel(txObj.output.x_s(:,1));



end