clear
clc

d = dir('./output_files/');
isub = [d(:).isdir];            % returns logical vector
nameFolds = {d(isub).name}';

nameFolds(ismember(nameFolds,{'.','..'})) = [];

if length(nameFolds) > 0

    fprintf(['\n\n\n\nThese are the available data sets: \n'])

    for j = 1:length(nameFolds)
        fprintf(['\nData set ', num2str(j), ': ', num2str(nameFolds{j}), ' \n'])
    
        if j == length(nameFolds)
            fprintf(['\n\n\n'])
        end
    
    end

    user.dataSetIndx  = input('Enter index of the data set you want to load: ');

    if user.dataSetIndx > 0 && user.dataSetIndx <= length(nameFolds)

        work.load  = sprintf('./output_files/%s/wSpace/wsp_all.mat', nameFolds{user.dataSetIndx});
        
        load(work.load)
        
        addpath('./eNOEprogram/handTools/');
        addpath('./eNOEprogram/shared/');
        addpath('./eNOEprogram/lib/');
        addpath('./eNOEprogram/read_in/');
        addpath('./eNOEprogram/read_in/numcode/');
        addpath('./eNOEprogram/read_in/sigmaData/');
        addpath('./eNOEprogram/read_in/nmrDrawTab/');
        addpath('./eNOEprogram/read_in/intensityFiles/');
        addpath('./eNOEprogram/read_out/');
        addpath('./eNOEprogram/setupAndMaster/');
        addpath('./eNOEprogram/buildups/');
        addpath('./eNOEprogram/relaxation/');
        addpath('./eNOEprogram/spinDiffusion/');
        addpath('./eNOEprogram/spinDiffusion/3spin/');
        addpath('./eNOEprogram/spinDiffusion/shared/');
        addpath('./eNOEprogram/spinDiffusion/fullMatrix/');
        addpath('./eNOEprogram/sigmaCorrDist/');
        addpath('./eNOEprogram/plots/');
        addpath('./eNOEprogram/plots/auto/');
        addpath('./eNOEprogram/plots/basicFun/');
        addpath('./eNOEprogram/plots/interactive/');
        addpath('./eNOEprogram/rasMol/');
        addpath('./input_files/');
        addpath('./output_files/');
        addpath(user.inputDirectory);
        addpath(user.outputDirectory);
    
        clc
        
        work.path
        
        user
    
        helpMenu
        
    elseif user.dataSetIndx <= 0 || user.dataSetIndx > length(nameFolds)
        fprintf(['\n\nThe data set you try to select does not exist\n\n'])
    end
    
elseif length(nameFolds) == 0
    fprintf(['\n\nYou have no data sets in the ouput_files directory\n\n'])
end







