function [ExpName, TrialN] = TrialFind(H,T,A,O)
% [ExpName, TrialN] = TrialFind(H,T,A,O)
% H - Wave Height in cm
% T - Wave Period in seconds
% A - Opening Ratio in %
% O - Incident Wave Angle
% Function finds the experiment name and trial number of each test.
% For Decay Tests:
% T = 0 for Decay Tests
% T = -1 for Irregular
% A = TrialN

roster = load('Roster.csv');
n = 1;
flag = 0;

if T ~= 0 && T ~= -1
    ExpName = 'Green_Reg_Alpha';
    TrialN = 0;

    while TrialN == 0

        if H == roster(n,2) && T == roster(n,3)
            if A == roster(n,4) && O == roster(n,5)
                if roster(n,1) < 10
                    TN = num2str(roster(n,1));
                    TrialN = horzcat('Trial0',TN);
                    flag =1;
                else
                    TN = num2str(roster(n,1));
                    TrialN = horzcat('Trial',TN);
                    flag =1;
                end

                if n > 92
                    Alpha = A*10;
                    ExpName = horzcat(ExpName,num2str(Alpha),'_2');
                    %             elseif A == 0.7 && H ~= 8
                    %                 Alpha = A*10;
                    %                 ExpName = horzcat(ExpName,num2str(Alpha),'_2');
                    %             elseif T == 1.75 && A == 0.7
                    %                 Alpha = A*10;
                    %                 ExpName = horzcat(ExpName,num2str(Alpha),'_2');
                    flag =1;
                else
                    Alpha = A*10;
                    ExpName = horzcat(ExpName,num2str(Alpha));
                    flag =1;
                end
            end

            if n == 105 && flag == 0;
                TrailN = 1;
                ExpName = 0;
                disp('Something is wrong')
            end
        end
        n = n+1;
    end
end

if T == -1
    Alpha = A*10;
    ExpName = 'Green_RNG_Alpha';
    if O == 0
        TN = '1';
    elseif O == 15 && Alpha ~= 15
        TN = '2';
    elseif O == 25 && Alpha ~= 15
        TN = '3';
    else
        disp('Alpha15 does not exist')
    end
    TrialN = horzcat('Trial0',TN);
    ExpName = horzcat(ExpName,num2str(Alpha));
end

if T == 0
    ExpName = 'FreeDecay1';

    if A < 10
        TN = num2str(A);
        TrialN = horzcat('Trial0',TN);
    else
        TN = num2str(A);
        TrialN = horzcat('Trial',TN);
    end
end
end