%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%         search diagDecay using assignment           %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clearvars srch

prompt = {'Using letter code (y/n):','RES1:','ATOM1:'};
dlg_title = 'Search diagDecay';
num_lines = 1;
def = {'n','6','1'};

srch.input = inputdlg(prompt,dlg_title,num_lines,def);

if isempty(srch.input)
    break
elseif ~isempty(srch.input)
    
        srch.index1 = find(ismember(arrayfun(@(x) x.numcode.ASSi, diagDecay), str2num(srch.input{2})));
        srch.index2 = find(ismember(arrayfun(@(x) x.numcode.ATOMi, diagDecay), str2num(srch.input{3})));
        
    if srch.input{1} == 'y'
        
        
    elseif srch.input{1} == 'n'
    
        diagDecayUniqueIndx = intersect(srch.index1, srch.index2);

        if ~isempty(diagDecayUniqueIndx)
            fprintf(['\n\n', 'diagDecay(',num2str(diagDecayUniqueIndx),')\n\n'])
            disp(diagDecay(diagDecayUniqueIndx))
        else
            fprintf(['\n\nThere is no assignment corresponding to: ', srch.input{2}, ' ', srch.input{3}, ' ', srch.input{4}, ' ', srch.input{5} '\n'])
        end
    end
            
end

clearvars prompt ans dlg_title num_lines def i srch diagDecayUniqueIndx

