%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%plots Sigma AB vs. BA if available for the NOEs chosen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% both directions are available and good
if temp.B1 ~= 0 && temp.B2 ~= 0
       
        screenMsg = sprintf(['\n', 'Plotting and saving: ', num2str(temp.B1), ' and ', num2str(temp.B2), '\n']);
        fprintf([deleteScreenMsg, screenMsg])
        deleteScreenMsg = repmat(sprintf('\b'), 1, length(screenMsg));

        subplot(1,1,1); hold('on'); xlabel('time'); ylabel('Intensity [1/1000]');
            
        if isfield(sigmaData(temp.B1).input, 'INDEX')
            w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e  tabFileIndex = %6d \n%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e  tabFileIndex = %6d \n'...
            , sigmaData(temp.B1).ASSi, sigmaData(temp.B1).ATOMi, sigmaData(temp.B1).ASSj, sigmaData(temp.B1).ATOMj ...
            , sigmaData(temp.B1).buildups.sigmaij, sigmaData(temp.B1).buildups.chiN, sigmaData(temp.B1).input.INDEX ...
            , sigmaData(temp.B2).ASSi, sigmaData(temp.B2).ATOMi, sigmaData(temp.B2).ASSj, sigmaData(temp.B2).ATOMj ...
            , sigmaData(temp.B2).buildups.sigmaij, sigmaData(temp.B2).buildups.chiN, sigmaData(temp.B2).input.INDEX);
            title(w);
        else
            w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e \n%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e \n'...
            , sigmaData(temp.B1).ASSi, sigmaData(temp.B1).ATOMi, sigmaData(temp.B1).ASSj, sigmaData(temp.B1).ATOMj...
            , sigmaData(temp.B1).buildups.sigmaij, sigmaData(temp.B1).buildups.chiN...
            , sigmaData(temp.B2).ASSi, sigmaData(temp.B2).ATOMi, sigmaData(temp.B2).ASSj, sigmaData(temp.B2).ATOMj...
            , sigmaData(temp.B2).buildups.sigmaij, sigmaData(temp.B2).buildups.chiN);
            title(w);
        end
        
        mColor = 'green';
        temp.B = temp.B1;
        plot_SingleSigma(sigmaData, temp, mColor)
        
        mColor = 'red';
        temp.B = temp.B2;
        plot_SingleSigma(sigmaData, temp, mColor)
        
        hold('off')
        
    
% first direction is available and good but second is not
elseif temp.B1 ~= 0 && temp.B2 == 0
    
        screenMsg = sprintf(['\n', 'Plotting and saving: ', num2str(temp.B1), '\n']);
        fprintf([deleteScreenMsg, screenMsg])
        deleteScreenMsg = repmat(sprintf('\b'), 1, length(screenMsg));

        subplot(1,1,1); hold('on'); xlabel('time'); ylabel('Intensity [1/1000]');

        if isfield(sigmaData(temp.B1).input, 'INDEX')
            w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e  tabFileIndex = %6d \n'...
            , sigmaData(temp.B1).ASSi, sigmaData(temp.B1).ATOMi, sigmaData(temp.B1).ASSj, sigmaData(temp.B1).ATOMj...
            , sigmaData(temp.B1).buildups.sigmaij, sigmaData(temp.B1).buildups.chiN, sigmaData(temp.B1).input.INDEX);
            title(w);
        else
            w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e \n'...
            , sigmaData(temp.B1).ASSi, sigmaData(temp.B1).ATOMi, sigmaData(temp.B1).ASSj, sigmaData(temp.B1).ATOMj...
            , sigmaData(temp.B1).buildups.sigmaij, sigmaData(temp.B1).buildups.chiN);
            title(w);
        end
    
        mColor = 'green';
        temp.B = temp.B1;
        plot_SingleSigma(sigmaData, temp, mColor)
        
        hold('off')
        
% first direction not available but second is available and good       
elseif temp.B1 == 0 && temp.B2 ~= 0
     
        screenMsg = sprintf(['\n', 'Plotting and saving: ', num2str(temp.B2), '\n']);
        fprintf([deleteScreenMsg, screenMsg])
        deleteScreenMsg = repmat(sprintf('\b'), 1, length(screenMsg));

        subplot(1,1,1); hold('on'); xlabel('time'); ylabel('Intensity [1/1000]');
            if isfield(sigmaData(temp.B1).input, 'INDEX')
                 w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e  tabFileIndex = %6d \n'...
                , sigmaData(temp.B2).ASSi, sigmaData(temp.B2).ATOMi, sigmaData(temp.B2).ASSj, sigmaData(temp.B2).ATOMj...
                , sigmaData(temp.B2).buildups.sigmaij, sigmaData(temp.B2).buildups.chiN, sigmaData(temp.B2).input.INDEX);
                title(w);
            else
                w = sprintf('%6d%6s%6d%6s               sigmaij = %6.4f  chiN = %14.2e \n'...
                , sigmaData(temp.B2).ASSi, sigmaData(temp.B2).ATOMi, sigmaData(temp.B2).ASSj, sigmaData(temp.B2).ATOMj...
                , sigmaData(temp.B2).buildups.sigmaij, sigmaData(temp.B2).buildups.chiN);
                title(w);
            end
            
        mColor = 'red';
        temp.B = temp.B2;
        plot_SingleSigma(sigmaData, temp, mColor)
        
        hold('off')
   
end