% 1 = TrialNum	
% 2 = CurrentRoundLeft	
% 3 = CurrentRoundRight	
% 4 = RewardLeft	
% 5 = RewardRight	
% 6 = RoundColor	
% 7 = RoundConditionLeft	
% 8 = RoundConditionRight	
% 9 = SlotChoice	
% 10 = GambsChooseLeft
% 11 = ProbeCondition
% 12 = Demographics
% 13 = RT
%%


%% new data
% 1 = participantSessionId	    -probably don't need, can put at the end
% 2 = participantNum	        -this will be come the file name, won't
% 3 = roundNum	                -index 1
% 4 = payoffCons	            -payoff consensus level: 0 = dissent, 1 =partial consensus, 2 = full consensus (treat 1 and 2 as same I think
% 5 = choice	                -what do you think
% 6 = groupFullCons	            -binary for yes or no, maybe use this instead of payoffCons
% 7 = rewardWin	                -binary
% 8 = condition	                -what do you think
% 9 = rewardLeft	            -
% 10 = rewardRight	            -
% 11 = imageLeft	            -
% 12 = imageRight	            -
% 13 = ProbeType	            -probe type (string)
% 14 = colors                   -colors in order (string)

%% now, need to read in the 2 rating files and append to these data

% loop through subjects, for each sub, what we care about most is probe trials: 
% wanna know when they have same shape and diff colors, those colors correspond to these 4 conditions: 
% how often did they pick the color that corresponds to each condition 
% (count number of times each condition was chosen) put that in matrix, take mean across subjects
clear
clc

d=dir('*.csv');


for s=1:length({d.name}) % for each file/subject
    format longg
    
    dat = readtable(d(s).name);
    d(s).name
    % get matrix info for current (s) subject
    condOneChoseCount = 0;
    condTwoChoseCount = 0;
    condThreeChoseCount = 0;
    condFourChoseCount = 0;
    condOneCount = 0;
    condTwoCount = 0;
    condThreeCount = 0;
    condFourCount = 0;

    condOneChose1v2Count = 0;
    condTwoChose1v2Count = 0;

    condOneChose1v3Count = 0;
    condThreeChose1v3Count = 0;

    condTwoChose2v3Count = 0;
    condThreeChose2v3Count = 0;

    condTwoChose2v4Count = 0;
    condFourChose2v4Count = 0;

    condThreeChose3v4Count = 0;
    condFourChose3v4Count = 0;

    %condOneChoseCountIcon1 = 0;
    %condTwoChoseCountIcon1 = 0;
    %condThreeChoseCountIcon1 = 0;
    %condFourChoseCountIcon1 = 0;
    condOneCountIcon1 = 0;
    condTwoCountIcon1 = 0;
    condThreeCountIcon1 = 0;
    condFourCountIcon1 = 0;

    %condOneChoseCountIcon2 = 0;
    %condTwoChoseCountIcon2 = 0;
    %condThreeChoseCountIcon2 = 0;
    %condFourChoseCountIcon2 = 0;
    condOneCountIcon2 = 0;
    condTwoCountIcon2 = 0;
    condThreeCountIcon2 = 0;
    condFourCountIcon2 = 0;

    %condOneChoseCountIcon3 = 0;
    %condTwoChoseCountIcon3 = 0;
    %condThreeChoseCountIcon3 = 0;
    %condFourChoseCountIcon3 = 0;
    condOneCountIcon3 = 0;
    condTwoCountIcon3 = 0;
    condThreeCountIcon3 = 0;
    condFourCountIcon3 = 0;

   
    condOneCountIcon4 = 0;
    condTwoCountIcon4 = 0;
    condThreeCountIcon4 = 0;
    condFourCountIcon4 = 0;

    highCount = 0;
    lowCount = 0; %4,5

    probeTrialOneCount = 0;
    probeTrialTwoCount = 0;
    probeTrialNoneCount = 0;
    

    probeTrialZeroIcon0Count = 0;
    probeTrialZeroIcon1Count = 0;
    probeTrialZeroIcon2Count = 0;
    probeTrialZeroIcon3Count = 0;
    probeTrialOneIcon0Count = 0;
    probeTrialOneIcon1Count = 0;
    probeTrialOneIcon2Count = 0;
    probeTrialOneIcon3Count = 0;
    condOneChoseIcon0Count = 0;
    condOneChoseIcon1Count = 0;
    condOneChoseIcon2Count = 0;
    condOneChoseIcon3Count = 0;
    condTwoChoseIcon0Count = 0;
    condTwoChoseIcon1Count = 0;
    condTwoChoseIcon2Count = 0;
    condTwoChoseIcon3Count = 0;
    condThreeChoseIcon0Count = 0;
    condThreeChoseIcon1Count = 0;
    condThreeChoseIcon2Count = 0;
    condThreeChoseIcon3Count = 0;
    condFourChoseIcon0Count = 0;
    condFourChoseIcon1Count = 0;
    condFourChoseIcon2Count = 0;
    condFourChoseIcon3Count = 0;



    roundCondition = 0;
    currentRound = 0;
    conditionChoice = 0;
    iconChoice = 0;
    rewChoice = 0;
    iconOppChoice = 0;

    meanRew1Count = 0;
    meanRew2Count = 0;
    meanRew3Count = 0;
    meanRew4Count = 0;
   

    meanRew1Cond1Count = 0;
    meanRew1Cond2Count = 0;
    meanRew1Cond3Count = 0;
    meanRew1Cond4Count = 0;

    meanRew2Cond1Count = 0;
    meanRew2Cond2Count = 0;
    meanRew2Cond3Count = 0;
    meanRew2Cond4Count = 0;

    meanRew3Cond1Count = 0;
    meanRew3Cond2Count = 0;
    meanRew3Cond3Count = 0;
    meanRew3Cond4Count = 0;
    meanRew3Cond4LeftCount = 0;
    meanRew3Cond4RightCount = 0;

    meanRew4Cond1Count = 0;
    meanRew4Cond2Count = 0;
    meanRew4Cond3Count = 0;
    meanRew4Cond4Count = 0;



    meanRew1Cond1 = 0;
    meanRew1Cond2 = 0;
    meanRew1Cond3 = 0;
    meanRew1Cond4 = 0;

    meanRew2Cond1 = 0;
    meanRew2Cond2 = 0;
    meanRew2Cond3 = 0;
    meanRew2Cond4 = 0;

    meanRew3Cond1 = 0;
    meanRew3Cond2 = 0;
    meanRew3Cond3 = 0;

    meanRew4Cond1 = 0;
    meanRew4Cond2 = 0;
    meanRew4Cond3 = 0;
    meanRew4Cond4 = 0;

    fullCons1Counter = 0;
    fullCons2Counter = 0;
    partialCons1Counter = 0;
    partialCons2Counter = 0;
    cond3Counter = 0;
    cond4Counter = 0;

    meanHigh1Count = 0;
    meanHigh2Count = 0;
    meanLow1Count = 0;
    meanLow2Count = 0;

    counter = 0
    ego = 0
    allo = 0
    egoCounter = 0 
    alloCounter = 0
    
%     condOneChange = zeros(16, 1, s);
%     condTwoChange = zeros(16, 1, s);
%     condThreeChange = zeros(16, 1, s);
%     condFourChange = zeros(16, 1, s);
    
    ratingsMat(24, 1) = NaN;
    q = 1;

    % do for loop through each trial
    
    % need to get delta for each condition in probe trials
    for i = 1:height(dat)
        
        %if dat(i, 13) > 0 this throws error b/c its a table
        if dat.ProbeType(i) > 0 % if probe trial
            

            % new stuff:
            % For each consensus/win (color) condition, 
            % plot separately for high and low reward shapes
            % so, there will be 4 plots for each condition, resulting in 16
            % plots. first step: get conditions. Then, get id of icon
            % present (this will be different for probe type 2, it'll be
            % the opposite where we get the 1 condition, and get the 2 ids
            % of icons
            % we already have these variables: roundConditionLeft,
            % roundConditionRight, but need roundIconID.
            % then, once we get these variables for the current trial,
            % determine the mean (just as we did for the condition means)
            % but for each icon. so now each condition mean is going to
            % have 4 different means, one for each icon

            % problem: currently, im iterating at each condition both the
            % counter and the 'chose' counter, so they're all 100%
            % need to figure out how to iterate and get proper proportions

            %there are 12 probe trials for each type (12 for type 0, 12 for
            %type 1). that means that there are 12 opportunities for each
            %condition to be picked. out of those 12, must determine 1.)
            %how many times did each icon get displayed, and 2.) how many
            %times did that icon get chosen
            currCondition = dat.condition(i)
            
            
            %%
            % add code to assess difference in probe choice preference
            % between early and late trials. To do this, add a conditional
            % statement somewhere in this loop which gets trial #. If trial
            % number is < 72, early trial. If # is > 72, late trial. One
            % thing to keep in mind though, is that some probe types may
            % have more instances in the later half because trial type is
            % randomly chosen. So, instead maybe get a probe trial type
            % count for each type, and if count < 5, early, elseif count >
            % 4, late 



          
            slotChoice = dat.choice(i)
            if dat.ProbeType(i) == 1 %probe type is 1 (1v3)
                roundIconIDLeft = dat.imageLeft(i)
                %ignore?
                roundIconIDRight = dat.imageRight(i)
                %ignore?


                %probeTrial1v3Count =  probeTrial1v3Count + 1; % increment # of probe trial 0's by 1
                probeTrialOneCount = probeTrialOneCount + 1
                % going to be array [l, r]
                if slotChoice == 37
                    if strcmp(currCondition, '1 v 3')
                        conditionChoice = 1
                    elseif strcmp(currCondition, '3 v 1')
                        conditionChoice = 3
                    end
                elseif slotChoice == 39
                    if strcmp(currCondition, '1 v 3')
                        conditionChoice = 3
                    elseif strcmp(currCondition, '3 v 1')
                        conditionChoice = 1
                    end
                end
               
                if conditionChoice == 1 % if subject chose condition 1 when given option b/t 1 and 3
                    
                    condOneChoseCount = condOneChoseCount + 1;
                    
                    
                elseif conditionChoice == 3
                    
                    condThreeChoseCount = condThreeChoseCount + 1;
                   
                end


                condOneChange(probeTrialOneCount,1,s) = condOneChoseCount/probeTrialOneCount;
                condThreeChange(probeTrialOneCount,1,s) = condThreeChoseCount/probeTrialOneCount;

            elseif dat.ProbeType(i) == 2 %(2v4)
                roundIconIDLeft = dat.imageLeft(i)
                roundIconIDRight = dat.imageRight(i)


                probeTrialTwoCount =  probeTrialTwoCount + 1;
                roundConditionLeft = 2
                roundConditionRight = 4
                if slotChoice == 37
                    if strcmp(currCondition, '2 v 4')
                        conditionChoice = 2
                    elseif strcmp(currCondition, '4 v 2')
                        conditionChoice = 4
                    end
                elseif slotChoice == 39
                    if strcmp(currCondition, '2 v 4')
                        conditionChoice = 4
                    elseif strcmp(currCondition, '4 v 2')
                        conditionChoice = 2
                    end
                end
                if conditionChoice == 2
                    
                    condTwoChoseCount = condTwoChoseCount + 1;
    
                elseif conditionChoice == 4
                   
                    condFourChoseCount = condFourChoseCount + 1;
  
                end

                condTwoChange(probeTrialTwoCount,1,s) = condTwoChoseCount/probeTrialTwoCount;
                condFourChange(probeTrialTwoCount,1,s) = condFourChoseCount/probeTrialTwoCount;
            
            elseif dat.ProbeType(i) == 3 % high v low
                roundIconIDLeft = dat.imageLeft(i)
                roundIconIDRight = dat.imageRight(i)


                probeTrialNoneCount = probeTrialNoneCount + 1;
                roundCondition = dat.condition(i);
                currentRoundLeft = dat.imageLeft(i);
                currentRoundRight = dat.imageRight(i);



                if slotChoice == 37
                    iconChoice = string(currentRoundLeft);
                    iconOppChoice = string(currentRoundRight);
                    highCount = highCount + 1;
                elseif slotChoice == 39
                    iconChoice = string(currentRoundRight);
                    iconOppChoice = string(currentRoundLeft);
                    lowCount = lowCount + 1;
                end

            end
            % elseif dat.ProbeType(i) == 3 % 1 v 2
            %     roundIconIDLeft = dat.imageLeft(i)
            %     roundIconIDRight = dat.imageRight(i)
            % 
            % 
            %     probeTrial1v2Count =  probeTrial1v2Count + 1;
            %     roundConditionLeft = 1
            %     roundConditionRight = 2
            %     if slotChoice == 37
            %         if strcmp(currCondition, '1 v 2')
            %             conditionChoice = 1
            %         elseif strcmp(currCondition, '2 v 1')
            %             conditionChoice = 2
            %         end
            %     elseif slotChoice == 39
            %         if strcmp(currCondition, '1 v 2')
            %             conditionChoice = 2
            %         elseif strcmp(currCondition, '2 v 1')
            %             conditionChoice = 1
            %         end
            %     end
            %     if conditionChoice == 1
            % 
            %         condOneChose1v2Count = condOneChose1v2Count + 1;
            %         condOneCount = condOneCount + 1;
            % 
            %     elseif conditionChoice == 2
            % 
            %         condTwoChose1v2Count = condTwoChose1v2Count + 1;
            %         condTwoCount = condTwoCount + 1;
            % 
            %     end
            % 
            % 
            % 
            %     condOneChange(probeTrial1v2Count,1,s) = condOneChoseCount/probeTrial1v2Count;
            %     condTwoChange(probeTrial1v2Count,1,s) = condTwoChoseCount/probeTrial1v2Count;
            % elseif dat.ProbeType(i) == 4 % 2v3
            %     roundIconIDLeft = dat.imageLeft(i)
            %     roundIconIDRight = dat.imageRight(i)
            % 
            % 
            %     probeTrial2v3Count =  probeTrial2v3Count + 1;
            %     roundConditionLeft = 2
            %     roundConditionRight = 3
            %     if slotChoice == 37
            %         if strcmp(currCondition, '2 v 3')
            %             conditionChoice = 2
            %         elseif strcmp(currCondition, '3 v 2')
            %             conditionChoice = 3
            %         end
            %     elseif slotChoice == 39
            %         if strcmp(currCondition, '2 v 3')
            %             conditionChoice = 3
            %         elseif strcmp(currCondition, '3 v 2')
            %             conditionChoice = 2
            %         end
            %     end
            %     if conditionChoice == 2
            % 
            %         condTwoChose2v3Count = condTwoChose2v3Count + 1;
            %         condTwoCount = condTwoCount + 1;
            % 
            %     elseif conditionChoice == 3
            % 
            %         condThreeChose2v3Count = condThreeChose2v3Count + 1;
            %         condThreeCount = condThreeCount + 1;
            % 
            %     end
            %     condTwoChange(probeTrial2v3Count,1,s) = condTwoChoseCount/probeTrial2v3Count;
            %     condThreeChange(probeTrial2v3Count,1,s) = condThreeChoseCount/probeTrial2v3Count;
            % 
            % elseif dat.ProbeType(i) == 5 % 3v4
            %     roundIconIDLeft = dat.imageLeft(i)
            %     roundIconIDRight = dat.imageRight(i)
            % 
            % 
            %     probeTrial3v4Count =  probeTrial3v4Count + 1;
            %     roundConditionLeft = 3
            %     roundConditionRight = 4
            %     if slotChoice == 37
            %         if strcmp(currCondition, '3 v 4')
            %             conditionChoice = 3
            %         elseif strcmp(currCondition, '4 v 3')
            %             conditionChoice = 4
            %         end
            %     elseif slotChoice == 39
            %         if strcmp(currCondition, '3 v 4')
            %             conditionChoice = 4
            %         elseif strcmp(currCondition, '4 v 3')
            %             conditionChoice = 3
            %         end
            %     end
            %     if conditionChoice == 3
            % 
            %         condThreeChose3v4Count = condThreeChose3v4Count + 1;
            %         condThreeCount = condThreeCount + 1;
            % 
            %     elseif conditionChoice == 4
            % 
            %         condFourChose3v4Count = condFourChose3v4Count + 1;
            %         condFourCount = condFourCount + 1;
            % 
            %     end
            %     condThreeChange(probeTrial3v4Count,1,s) = condThreeChoseCount/probeTrial3v4Count;
            %     condFourChange(probeTrial3v4Count,1,s) = condFourChoseCount/probeTrial3v4Count;
            % 
            % elseif dat.ProbeType(i) == 6 % high v low
            %     roundIconIDLeft = dat.imageLeft(i)
            %     roundIconIDRight = dat.imageRight(i)
            % 
            % 
            %     probeTrialNoneCount = probeTrialNoneCount + 1;
            %     roundCondition = dat.condition(i);
            %     currentRoundLeft = dat.imageLeft(i);
            %     currentRoundRight = dat.imageRight(i);
            % 
            % 
            % 
            %     if slotChoice == 37
            %         iconChoice = string(currentRoundLeft);
            %         iconOppChoice = string(currentRoundRight);
            %         highCount = highCount + 1;
            %     elseif slotChoice == 39
            %         iconChoice = string(currentRoundRight);
            %         iconOppChoice = string(currentRoundLeft);
            %         lowCount = lowCount + 1;
            %     end



        else % normal trial
            % get mean reward payout for each icon
            %gotta figure out how to tackle icons. maybe write some code at
            %top taking the first couple rounds and determining which icons
            %are which level

            %%update: circle & diamond are always high, star & moon are
            %%always low
            %currIconLeft = dat(i, 11);
            currIconLeft = dat.imageLeft(i)
            %currIconRight = dat(i, 12);
            currIconRight = dat.imageRight(i)
            %below are changed
            %currRewLeft = dat(i, 9);
            currRewLeft = dat.rewardLeft(i)
            %currRewRight = dat(i, 10);
            currRewRight = dat.rewardRight(i)

            currRewLevel = dat.rewardLevel(i)
            currRewWin = dat.rewardWin(i)
            %currCondition = dat(i, 8);
            currCondition = dat.condition(i)
            
            
            %slotChoice = dat(i, 5);
            slotChoice = dat.choice(i)
            fullCons = dat.groupFullCons(i)

%% new stuff
            if currRewLevel == 1 %% these two icons on this trial are high reward
                iconHigh1 = currIconLeft
                iconHigh2 = currIconRight
                % get which trial lost
                if currRewWin == 1
                    if slotChoice == 37
                        meanHigh1Count = meanHigh1Count + 1;
                        meanHigh1(meanHigh1Count)  = currRewLeft;
                        meanHigh2Count = meanHigh2Count + 1;
                        meanHigh2(meanHigh2Count)  = 0;
                    elseif slotChoice == 39
                        meanHigh1Count = meanHigh1Count + 1;
                        meanHigh1(meanHigh1Count)  = 0;
                        meanHigh2Count = meanHigh2Count + 1;
                        meanHigh2(meanHigh2Count)  = currRewRight;
                    end
                elseif currRewWin == 0
                    if slotChoice == 37
                        meanHigh1Count = meanHigh1Count + 1;
                        meanHigh1(meanHigh1Count)  = 0;
                        meanHigh2Count = meanHigh2Count + 1;
                        meanHigh2(meanHigh2Count)  = currRewRight;
                    elseif slotChoice == 39
                        meanHigh1Count = meanHigh1Count + 1;
                        meanHigh1(meanHigh1Count)  = currRewLeft;
                        meanHigh2Count = meanHigh2Count + 1;
                        meanHigh2(meanHigh2Count)  = 0;
                    end
                end
            elseif currRewLevel == 0
                iconLow1 = currIconLeft
                iconLow2 = currIconRight
                % get which trial lost
                if currRewWin == 1
                    if slotChoice == 37
                        meanLow1Count = meanLow1Count + 1;
                        meanLow1(meanLow1Count)  = currRewLeft;
                        meanLow2Count = meanLow2Count + 1;
                        meanLow2(meanLow2Count)  = 0;
                    elseif slotChoice == 39
                        meanLow1Count = meanLow1Count + 1;
                        meanLow1(meanLow1Count)  = 0;
                        meanLow2Count = meanLow2Count + 1;
                        meanLow2(meanLow2Count)  = currRewRight;
                    end
                elseif currRewWin == 0
                    if slotChoice == 37
                        meanLow1Count = meanLow1Count + 1;
                        meanLow1(meanLow1Count)  = 0;
                        meanLow2Count = meanLow2Count + 1;
                        meanLow2(meanLow2Count)  = currRewRight;
                    elseif slotChoice == 39
                        meanLow1Count = meanLow1Count + 1;
                        meanLow1(meanLow1Count)  = currRewLeft;
                        meanLow2Count = meanLow2Count + 1;
                        meanLow2(meanLow2Count)  = 0;
                    end
                end
            end




%% end new stuff




            %left rew
           
            %if currIconLeft == 'circle'  % icon 1
            %if dat.imageLeft(i) == 'circle'
            if strcmp(currIconLeft, 'diamond') == 1
               
                meanRew1Count = meanRew1Count + 1;
                meanRew1(meanRew1Count)  = currRewLeft;
            %elseif currIconLeft == 'diamond' % icon 2
            elseif strcmp(currIconLeft, 'square') == 1
                meanRew2Count = meanRew2Count + 1;
                meanRew2(meanRew2Count)  = currRewLeft;
            %elseif currIconLeft == 'star' % icon 3
            elseif strcmp(currIconLeft, 'triangle') == 1
                meanRew3Count = meanRew3Count + 1;
                meanRew3(meanRew3Count)  = currRewLeft;
            %elseif currIconLeft == 'moon' % icon 4
            elseif strcmp(currIconLeft, 'circle') == 1
                meanRew4Count = meanRew4Count + 1;
                meanRew4(meanRew4Count)  = currRewLeft;
            end

            %right rew
            %if currIconRight == 'circle' % icon 1
            if strcmp(currIconRight, 'diamond') == 1
                % do some operation to add this value to current array and
                % then compute mean (or add to array and compute mean at
                % the end of the loop)
                meanRew1Count = meanRew1Count + 1;
                meanRew1(meanRew1Count)  = currRewRight;
            %elseif currIconRight == 'diamond' % icon 2
            elseif strcmp(currIconRight, 'square') == 1
                meanRew2Count = meanRew2Count + 1;
                meanRew2(meanRew2Count)  = currRewRight;
            %elseif currIconRight == 'star' % icon 3
            elseif strcmp(currIconRight, 'triangle') == 1
                meanRew3Count = meanRew3Count + 1;
                meanRew3(meanRew3Count)  = currRewRight;
            %elseif currIconRight == 'moon' % icon 4
            elseif strcmp(currIconRight, 'circle') == 1
                meanRew4Count = meanRew4Count + 1;
                meanRew4(meanRew4Count)  = currRewRight;
            end



            %here, write code for proportion of each consensus outcome
            % 6 total, including full cons-win, full cons-lose, partial
            % cons-win, partial cons-lose, dissent-win, dissent lose
            % for each trial, get condition
            %
            % if condition 1 (cons-win)
            %   get whether full or partial
            %   add to appropriate counter
            % elseif condition 2 (cons-lose)
            %   get whether full or partial
            %   add to appropriate counter
            % elseif condition 3 (dissent-win)
            %   add to counter
            % elseif condition 4 (dissent-lose)
            %   add to counter
            if class(currCondition) == 'cell'
                currCondition = char(currCondition)
                if strcmp(currCondition, '1_partial') == 1
                    currCondition = '1'
                elseif strcmp(currCondition, '2_partial') == 1
                    currCondition = '2'
                end 
            end
            
            if currCondition == '1' 
                if fullCons == 1
                    fullCons1Counter = fullCons1Counter + 1
                elseif fullCons == 0
                    partialCons1Counter = partialCons1Counter + 1
                end
            elseif currCondition == '2' 
                if fullCons == 1
                    fullCons2Counter = fullCons2Counter + 1
                elseif fullCons == 0
                    partialCons2Counter = partialCons2Counter + 1
                end
            elseif currCondition == '3'
                cond3Counter = cond3Counter + 1
            elseif currCondition == '4'
                cond4Counter = cond4Counter + 1
            end


            %get rew for each condition
            if currCondition == '1' 
                if slotChoice == 37
                    %if currIconLeft == 'circle' % icon 1
                    if strcmp(currIconLeft, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond1Count = meanRew1Cond1Count + 1;
                        meanRew1Cond1(meanRew1Cond1Count)  = currRewLeft;
                    %elseif currIconLeft == 'diamond' % icon 2
                    elseif strcmp(currIconLeft, 'square') == 1
                        meanRew2Cond1Count = meanRew2Cond1Count + 1;
                        meanRew2Cond1(meanRew2Cond1Count)  = currRewLeft;
                    %elseif currIconLeft == 'star' % icon 3
                    elseif strcmp(currIconLeft, 'triangle') == 1
                        meanRew3Cond1Count = meanRew3Cond1Count + 1;
                        meanRew3Cond1(meanRew3Cond1Count)  = currRewLeft;
                    %elseif currIconLeft == 'moon' % icon 4
                    elseif strcmp(currIconLeft, 'circle') == 1
                        meanRew4Cond1Count = meanRew4Cond1Count + 1;
                        meanRew4Cond1(meanRew4Cond1Count)  = currRewLeft;
                    end
                elseif slotChoice == 39
                    %right rew
                    %if currIconRight == 'circle' % icon 1
                    if strcmp(currIconRight, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond1Count = meanRew1Cond1Count + 1;
                        meanRew1Cond1(meanRew1Cond1Count)  = currRewRight;
                    %elseif currIconRight == 'diamond' % icon 2
                    elseif strcmp(currIconRight, 'square') == 1
                        meanRew2Cond1Count = meanRew2Cond1Count + 1;
                        meanRew2Cond1(meanRew2Cond1Count)  = currRewRight;
                    %elseif currIconRight == 'star' % icon 3
                    elseif strcmp(currIconRight, 'triangle') == 1
                        meanRew3Cond1Count = meanRew3Cond1Count + 1;
                        meanRew3Cond1(meanRew3Cond1Count)  = currRewRight;
                    %elseif currIconRight == 'moon' % icon 4
                    elseif strcmp(currIconRight, 'circle') == 1
                        meanRew4Cond1Count = meanRew4Cond1Count + 1;
                        meanRew4Cond1(meanRew4Cond1Count)  = currRewRight;
                    end
                end

            elseif currCondition == '2' 
                if slotChoice == 37
                    %if currIconLeft == 'circle' % icon 1
                    if strcmp(currIconLeft, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond2Count = meanRew1Cond2Count + 1;
                        meanRew1Cond2(meanRew1Cond2Count)  = currRewLeft;
                    %elseif currIconLeft == 'diamond' % icon 2
                    elseif strcmp(currIconLeft, 'square') == 1
                        meanRew2Cond2Count = meanRew2Cond2Count + 1;
                        meanRew2Cond2(meanRew2Cond2Count)  = currRewLeft;
                    %elseif currIconLeft == 'star' % icon 3
                    elseif strcmp(currIconLeft, 'triangle') == 1
                        meanRew3Cond2Count = meanRew3Cond2Count + 1;
                        meanRew3Cond2(meanRew3Cond2Count)  = currRewLeft;
                    %elseif currIconLeft == 'moon' % icon 4
                    elseif strcmp(currIconLeft, 'circle') == 1
                        meanRew4Cond2Count = meanRew4Cond2Count + 1;
                        meanRew4Cond2(meanRew4Cond2Count)  = currRewLeft;
                    end
                elseif slotChoice == 39
                    %right rew
                    %if currIconRight == 'circle' % icon 1
                    if strcmp(currIconRight, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond2Count = meanRew1Cond2Count + 1;
                        meanRew1Cond2(meanRew1Cond2Count)  = currRewRight;
                    %elseif currIconRight == 'diamond' % icon 2
                    elseif strcmp(currIconRight, 'square') == 1
                        meanRew2Cond2Count = meanRew2Cond2Count + 1;
                        meanRew2Cond2(meanRew2Cond2Count)  = currRewRight;
                    %elseif currIconRight == 'star' % icon 3
                    elseif strcmp(currIconRight, 'triangle') == 1
                        meanRew3Cond2Count = meanRew3Cond2Count + 1;
                        meanRew3Cond2(meanRew3Cond2Count)  = currRewRight;
                    %elseif currIconRight == 'moon' % icon 4
                    elseif strcmp(currIconRight, 'circle') == 1
                        meanRew4Cond2Count = meanRew4Cond2Count + 1;
                        meanRew4Cond2(meanRew4Cond2Count)  = currRewRight;
                    end
                end

            elseif currCondition == '3'
                if slotChoice == 37
                    %if currIconLeft == 'circle' % icon 1
                    if strcmp(currIconLeft, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond3Count = meanRew1Cond3Count + 1;
                        meanRew1Cond3(meanRew1Cond3Count)  = currRewLeft;
                    %elseif currIconLeft == 'diamond' % icon 2
                    elseif strcmp(currIconLeft, 'square') == 1
                        meanRew2Cond3Count = meanRew2Cond3Count + 1;
                        meanRew2Cond3(meanRew2Cond3Count)  = currRewLeft;
                    %elseif currIconLeft == 'star' % icon 3
                    elseif strcmp(currIconLeft, 'triangle') == 1
                        meanRew3Cond3Count = meanRew3Cond3Count + 1;
                        meanRew3Cond3(meanRew3Cond3Count)  = currRewLeft;
                    %elseif currIconLeft == 'moon' % icon 4
                    elseif strcmp(currIconLeft, 'circle') == 1
                        meanRew4Cond3Count = meanRew4Cond3Count + 1;
                        meanRew4Cond3(meanRew4Cond3Count)  = currRewLeft;
                    end
                elseif slotChoice == 39
                    %right rew
                    %if currIconRight == 'circle' % icon 1
                    if strcmp(currIconRight, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond3Count = meanRew1Cond3Count + 1;
                        meanRew1Cond3(meanRew1Cond3Count)  = currRewRight;
                    %elseif currIconRight == 'diamond' % icon 2
                    elseif strcmp(currIconRight, 'square') == 1
                        meanRew2Cond3Count = meanRew2Cond3Count + 1;
                        meanRew2Cond3(meanRew2Cond3Count)  = currRewRight;
                    %elseif currIconRight == 'star' % icon 3
                    elseif strcmp(currIconRight, 'triangle') == 1
                        meanRew3Cond3Count = meanRew3Cond3Count + 1;
                        meanRew3Cond3(meanRew3Cond3Count)  = currRewRight;
                        % they never chose 2 here, so there is nothing in
                        % 'if currIconRight == 2'
                    

                        %meanRew3Cond3Count(isnan(meanRew3Cond3Count)) = 0;
                        %meanRew3Cond3(isnan(meanRew3Cond3)) = 0;
                        
                    %elseif currIconRight == 'moon' % icon 4
                    elseif strcmp(currIconRight, 'circle') == 1
                        meanRew4Cond3Count = meanRew4Cond3Count + 1;
                        meanRew4Cond3(meanRew4Cond3Count)  = currRewRight;
                    end
                end

            elseif currCondition == '4'
                if slotChoice == 37
                    %if currIconLeft == 'circle' % icon 1
                    if strcmp(currIconLeft, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond4Count = meanRew1Cond4Count + 1;
                        meanRew1Cond4(meanRew1Cond4Count)  = currRewLeft;
                    %elseif currIconLeft == 'diamond' % icon 2
                    elseif strcmp(currIconLeft, 'square') == 1
                        meanRew2Cond4Count = meanRew2Cond4Count + 1;
                        meanRew2Cond4(meanRew2Cond4Count)  = currRewLeft;
                    %elseif currIconLeft == 'star' % icon 3
                    elseif strcmp(currIconLeft, 'triangle') == 1
                        meanRew3Cond4LeftCount = meanRew3Cond4LeftCount + 1
                        meanRew3Cond4Count = meanRew3Cond4Count + 1;
                        meanRew3Cond4(meanRew3Cond4Count)  = currRewLeft;
                    %elseif currIconLeft == 'moon' % icon 4
                    elseif strcmp(currIconLeft, 'circle') == 1
                        meanRew4Cond4Count = meanRew4Cond4Count + 1;
                        meanRew4Cond4(meanRew4Cond4Count)  = currRewLeft;
                    end
                elseif slotChoice == 39
                    %right rew
                    %if currIconRight == 'circle' % icon 1
                    if strcmp(currIconRight, 'diamond') == 1
                        % do some operation to add this value to current array and
                        % then compute mean (or add to array and compute mean at
                        % the end of the loop)
                        meanRew1Cond4Count = meanRew1Cond4Count + 1;
                        meanRew1Cond4(meanRew1Cond4Count)  = currRewRight;
                    %elseif currIconRight == 'diamond' % icon 2
                    elseif strcmp(currIconRight, 'square') == 1
                        meanRew2Cond4Count = meanRew2Cond4Count + 1;
                        meanRew2Cond4(meanRew2Cond4Count)  = currRewRight;
                    %elseif currIconRight == 'star' % icon 3
                    elseif strcmp(currIconRight, 'triangle') == 1
                        meanRew3Cond4RightCount = meanRew3Cond4RightCount + 1
                        meanRew3Cond4Count = meanRew3Cond4Count + 1;
                        meanRew3Cond4(meanRew3Cond4Count)  = currRewRight;
                    %elseif currIconRight == 'moon' % icon 4
                    elseif strcmp(currIconRight, 'circle') == 1
                        meanRew4Cond4Count = meanRew4Cond4Count + 1;
                        meanRew4Cond4(meanRew4Cond4Count)  = currRewRight;
                    end
                end

            end



        end
        
    %% need to bring this back in, but remove for now
        if dat.Var16(i) > -1 % Var16 = prerating #s
            %okay so this might be saying "if there is a number in these 2
            %columns"
            %if it is during the trials, there won't be a number. but at
            %the end of the trial rows, the rating numbers begin
            p = i+4;
            ratingsMatPre(q, 1, s) = dat.Var16(i); %creates pre-rating matrix
            ratingsMat(q, 1, s) = dat.Var18(i) - dat.Var16(i); 
            ratingsMatPost(q, 1, s) = dat.Var18(i);
            q = q+1;
        end
        
        % put variables in matrix
        % counter = 0
        % egoCounter = 0
        % alloCounter = 0
        % ego = 0
        % allo = 0
        if dat.Var20(i) > -1
            if counter < 8
                ego = ego + dat.Var20(i)
                egoCounter = egoCounter + 1
            else
                allo = allo + dat.Var20(i)
                alloCounter = alloCounter + 1
            end
            counter = counter + 1

        end
        egoMat(s) = ego
        alloMat(s) = allo
        
    end

    iconChoiceHighProportion(s) = highCount/probeTrialNoneCount;
    iconChoiceLowProportion(s) = lowCount/probeTrialNoneCount;

    condOneProportion(s) = condOneChoseCount/probeTrialOneCount;
    condTwoProportion(s) = condTwoChoseCount/probeTrialTwoCount;
    condThreeProportion(s) = condThreeChoseCount/probeTrialOneCount;
    condFourProportion(s) = condFourChoseCount/probeTrialTwoCount;

    highProportion(s) = highCount/probeTrialNoneCount
    lowProportion(s) = lowCount/probeTrialNoneCount

    % proportionMat = zeros(height(d),6)
    % proportionMat(:,1) = condOneProportion'
    % proportionMat(:,2) = condTwoProportion'
    % proportionMat(:,3) = condThreeProportion'
    % proportionMat(:,4) = condFourProportion'
    % proportionMat(:,5) = iconChoiceHighProportion'
    % proportionMat(:,6) = iconChoiceLowProportion'

%uncomment ^

 

    


    condOneIcon0Proportion(s) = condOneChoseIcon0Count/probeTrialZeroIcon0Count;
    condOneIcon1Proportion(s) = condOneChoseIcon1Count/probeTrialZeroIcon1Count;
    condOneIcon2Proportion(s) = condOneChoseIcon2Count/probeTrialZeroIcon2Count;
    condOneIcon2Proportion(isnan(condOneIcon2Proportion))=0;
    condOneIcon3Proportion(s) = condOneChoseIcon3Count/probeTrialZeroIcon3Count;

    condTwoIcon0Proportion(s) = condTwoChoseIcon0Count/probeTrialOneIcon0Count;
    condTwoIcon1Proportion(s) = condTwoChoseIcon1Count/probeTrialOneIcon1Count;
    condTwoIcon2Proportion(s) = condTwoChoseIcon2Count/probeTrialOneIcon2Count;
    condTwoIcon3Proportion(s) = condTwoChoseIcon3Count/probeTrialOneIcon3Count;

    condThreeIcon0Proportion(s) = condThreeChoseIcon0Count/probeTrialZeroIcon0Count;
    condThreeIcon1Proportion(s) = condThreeChoseIcon1Count/probeTrialZeroIcon1Count;
    condThreeIcon2Proportion(s) = condThreeChoseIcon2Count/probeTrialZeroIcon2Count;
    condThreeIcon2Proportion(isnan(condThreeIcon2Proportion))=0;
    condThreeIcon3Proportion(s) = condThreeChoseIcon3Count/probeTrialZeroIcon3Count;

    condFourIcon0Proportion(s) = condFourChoseIcon0Count/probeTrialOneIcon0Count;
    condFourIcon1Proportion(s) = condFourChoseIcon1Count/probeTrialOneIcon1Count;
    condFourIcon2Proportion(s) = condFourChoseIcon2Count/probeTrialOneIcon2Count;
    condFourIcon3Proportion(s) = condFourChoseIcon3Count/probeTrialOneIcon3Count;



    

    reward1(s) = sum(meanRew1)/meanRew1Count;
    reward2(s) = sum(meanRew2)/meanRew2Count;
    reward3(s) = sum(meanRew3)/meanRew3Count;
    reward4(s) = sum(meanRew4)/meanRew4Count;

    rewardHigh1(s) = sum(meanHigh1)/meanHigh1Count;
    rewardHigh2(s) = sum(meanHigh2)/meanHigh2Count;
    rewardLow1(s) = sum(meanLow1)/meanLow1Count;
    rewardLow2(s) = sum(meanLow2)/meanLow2Count;

    reward1Cond1(s) = sum(meanRew1Cond1)/meanRew1Cond1Count;
    reward2Cond1(s) = sum(meanRew2Cond1)/meanRew2Cond1Count;
    reward3Cond1(s) = sum(meanRew3Cond1)/meanRew3Cond1Count;
    reward4Cond1(s) = sum(meanRew4Cond1)/meanRew4Cond1Count;

    reward1Cond2(s) = sum(meanRew1Cond2)/meanRew1Cond2Count;
    reward2Cond2(s) = sum(meanRew2Cond2)/meanRew2Cond2Count;
    reward3Cond2(s) = sum(meanRew3Cond2)/meanRew3Cond2Count;
    reward4Cond2(s) = sum(meanRew4Cond2)/meanRew4Cond2Count;

    reward1Cond3(s) = sum(meanRew1Cond3)/meanRew1Cond3Count;
    reward2Cond3(s) = sum(meanRew2Cond3)/meanRew2Cond3Count;
    reward3Cond3(s) = sum(meanRew3Cond3)/meanRew3Cond3Count
    %reward3Cond3(isnan(reward3Cond3)) = 0;
    reward4Cond3(s) = sum(meanRew4Cond3)/meanRew4Cond3Count;

    reward1Cond4(s) = sum(meanRew1Cond4)/meanRew1Cond4Count;
    reward2Cond4(s) = sum(meanRew2Cond4)/meanRew2Cond4Count;
    reward3Cond4(s) = sum(meanRew3Cond4)/meanRew3Cond4Count;
    reward4Cond4(s) = sum(meanRew4Cond4)/meanRew4Cond4Count;

    meanReward1 = mean(reward1);
    meanReward2 = mean(reward2);
    meanReward3 = mean(reward3);
    meanReward4 = mean(reward4);

    meanRewardHigh1 = mean(rewardHigh1);
    meanRewardHigh2 = mean(rewardHigh2);
    meanRewardLow1 = mean(rewardLow1);
    meanRewardLow2 = mean(rewardLow2);

    meanReward1Cond1 = mean(reward1Cond1);
    meanReward2Cond1 = mean(reward2Cond1);
    meanReward3Cond1 = mean(reward3Cond1);
    meanReward4Cond1 = mean(reward4Cond1);
    meanRewardsCond1 = [meanReward1Cond1, meanReward2Cond1, meanReward3Cond1, meanReward4Cond1]

    meanReward1Cond2 = mean(reward1Cond2);
    meanReward2Cond2 = mean(reward2Cond2);
    meanReward3Cond2 = mean(reward3Cond2);
    meanReward4Cond2 = mean(reward4Cond2);
    meanRewardsCond2 = [meanReward1Cond2, meanReward2Cond2, meanReward3Cond2, meanReward4Cond2]

    meanReward1Cond3 = mean(reward1Cond3);
    meanReward2Cond3 = mean(reward2Cond3);
    %meanReward3Cond3 = mean(reward3Cond3);
    meanReward3Cond3 = mean(reward3Cond3, 'omitnan');
    meanReward4Cond3 = mean(reward4Cond3);
    meanRewardsCond3 = [meanReward1Cond3, meanReward2Cond3, meanReward3Cond3, meanReward4Cond3]

    meanReward1Cond4 = mean(reward1Cond4);
    meanReward2Cond4 = mean(reward2Cond4);
    meanReward3Cond4 = mean(reward3Cond4);
    meanReward4Cond4 = mean(reward4Cond4);
    meanRewardsCond4 = [meanReward1Cond4, meanReward2Cond4, meanReward3Cond4, meanReward4Cond4]

    
    fullCons1Proportion(s) = fullCons1Counter/120
    fullCons2Proportion(s) = fullCons2Counter/120
    partialCons1Proportion(s) = partialCons1Counter/120
    partialCons2Proportion(s) = partialCons2Counter/120
    cond3Proportion(s) = cond3Counter/120
    cond4Proportion(s) = cond4Counter/120
    
    %attempting to make 6x4xs matrix, rows: image, cols: condition, z: sub
    %uncomment below
    % ratings(1, :, s) = ratingsMat((1:4), 1, s)
    % ratings(2, :, s) = ratingsMat((5:8), 1, s);
    % ratings(3, :, s) = ratingsMat((9:12), 1, s);
    % ratings(4, :, s) = ratingsMat((13:16), 1, s);
    % ratings(5, :, s) = ratingsMat((17:20), 1, s);
    % ratings(6, :, s) = ratingsMat((21:24), 1, s);
    ratings(:, 1, s) = ratingsMat((1:6), 1, s)
    ratingsPre(:, 1, s) = ratingsMatPre((1:6), 1, s)
    % ratingsNew = pagetranspose(ratingsPre)
    % ratings = zeros(height(d),6)
    % for i = 1:height(d)
    %     ratings(i,:) = ratingsNew(:,:,i)
    % 
    % end
    %ratings(:, 2, s) = ratingsMat((5:8), 1, s);
    %ratings(:, 3, s) = ratingsMat((9:12), 1, s);
    %ratings(:, 4, s) = ratingsMat((13:16), 1, s);
    %ratings(:, 5, s) = ratingsMat((17:20), 1, s);
    %ratings(:, 6, s) = ratingsMat((21:24), 1, s);

    %ratings = ratings';

    %ratingsPre(:,1, s) = ratingsMatPre((1:6), 1, s);
    %ratingsPre(:,2, s) = ratingsMatPre((5:8), 1, s);
    %ratingsPre(:,3, s) = ratingsMatPre((9:12), 1, s);
    %ratingsPre(:,4, s) = ratingsMatPre((13:16), 1, s);
    %ratingsPre(:,5, s) = ratingsMatPre((17:20), 1, s);
    %ratingsPre(:,6, s) = ratingsMatPre((21:24), 1, s);

    %ratingsPre = ratingsPre';

    ratingsPost(:,1, s) = ratingsMatPost((1:6), 1, s);
    %ratingsPost(:,2, s) = ratingsMatPost((5:8), 1, s);
    %ratingsPost(:,3, s) = ratingsMatPost((9:12), 1, s);
    %ratingsPost(:,4, s) = ratingsMatPost((13:16), 1, s);
    %ratingsPost(:,5, s) = ratingsMatPost((17:20), 1, s);
    %ratingsPost(:,6, s) = ratingsMatPost((21:24), 1, s);

    %ratingsPost = ratingsPost';
    %rn, ratingsAvg is changing each trial based on subject. need for it to
    %average across s
    for i = 1:6
        ratingsAvg(1, i, s) = mean(ratings(i, :, s));
        ratingsAvgPre(1, i, s) = mean(ratingsPre(i, :, s))
        ratingsAvgPost(1, i, s) = mean(ratingsPost(i, :, s));
    end

 end
 for iii = 1:6
    ratingsAvgFinal(1,iii) = mean(ratingsAvg(1, iii, :))
    ratingsAvgPreFinal(1, iii) = mean(ratingsAvgPre(1, iii, :))
    ratingsAvgPostFinal(1, iii) = mean(ratingsAvgPost(1, iii, :))
 end

ratingsNew = pagetranspose(ratingsPre)
    ratings = zeros(height(d),6)
    for i = 1:height(d)
        ratings(i,:) = ratingsNew(:,:,i)

    end
meanOne = mean(condOneProportion, 'omitnan');
meanTwo = mean(condTwoProportion, 'omitnan');
meanThree = mean(condThreeProportion, 'omitnan');
meanFour = mean(condFourProportion, 'omitnan');

meanHigh = mean(highProportion)
meanLow = mean(lowProportion)



meanOneIcon1 = mean(condOneIcon0Proportion, "omitnan")
meanOneIcon2 = mean(condOneIcon1Proportion, "omitnan")
meanOneIcon3 = mean(condOneIcon2Proportion, "omitnan")
meanOneIcon4 = mean(condOneIcon3Proportion, "omitnan")

meanTwoIcon1 = mean(condTwoIcon0Proportion, "omitnan")
meanTwoIcon2 = mean(condTwoIcon1Proportion, "omitnan")
meanTwoIcon3 = mean(condTwoIcon2Proportion, "omitnan")
meanTwoIcon4 = mean(condTwoIcon3Proportion, "omitnan")

meanThreeIcon1 = mean(condThreeIcon0Proportion, "omitnan")
meanThreeIcon2 = mean(condThreeIcon1Proportion, "omitnan")
meanThreeIcon3 = mean(condThreeIcon2Proportion, "omitnan")
meanThreeIcon4 = mean(condThreeIcon3Proportion, "omitnan")

meanFourIcon1 = mean(condFourIcon0Proportion, "omitnan")
meanFourIcon2 = mean(condFourIcon1Proportion, "omitnan")
meanFourIcon3 = mean(condFourIcon2Proportion, "omitnan")
meanFourIcon4 = mean(condFourIcon3Proportion, "omitnan")

meanHighRew = sum(iconChoiceHighProportion)/s
meanLowRew = sum(iconChoiceLowProportion)/s


fprintf('------ Data ------\n\n');
fprintf('* Condition 1 Mean: ', d.name);
fprintf('%7.3f\n', meanOne);
fprintf('* Condition 2 Mean: ', d.name);
fprintf('%7.3f\n', meanTwo);
fprintf('* Condition 3 Mean: ', d.name);
fprintf('%7.3f\n', meanThree);
fprintf('* Condition 4 Mean: ', d.name);
fprintf('%7.3f\n', meanFour);

fprintf('* High Mean: ', d.name);
fprintf('%7.3f\n', meanHigh);
fprintf('* Low Mean: ', d.name);
fprintf('%7.3f\n', meanLow);


% fprintf('* 1 v 2:\n', d.name);
% fprintf('* Cond 1:%7.3f\n', meanOne1v2);
% fprintf('* Cond 2:%7.3f\n\n', meanTwo1v2);
% 
% fprintf('* 1 v 3:\n', d.name);
% fprintf('* Cond 1:%7.3f\n', meanOne1v3);
% fprintf('* Cond 3:%7.3f\n\n', meanThree1v3);
% 
% fprintf('* 2 v 3:\n', d.name);
% fprintf('* Cond 2:%7.3f\n', meanTwo2v3);
% fprintf('* Cond 3:%7.3f\n\n', meanThree2v3);
% 
% fprintf('* 2 v 4:\n', d.name);
% fprintf('* Cond 2:%7.3f\n', meanTwo2v4);
% fprintf('* Cond 4:%7.3f\n\n', meanFour2v4);
% 
% fprintf('* 3 v 4:\n', d.name);
% fprintf('* Cond 3:%7.3f\n', meanThree3v4);
% fprintf('* Cond 4:%7.3f\n\n', meanFour3v4);



iconValue = nan(276,6,5);
for ii = 1:length({d.name}) % for each subject
    data = readmatrix(d(ii).name);
    for jj=1:height(data) % for each trial
        if data(jj, 2) > -1
            if isnan(data(jj, 11)) % if normal trial
                if slotChoice == 37 % if chose left
                    iconID = data(jj, 2) + 1; % get id of icon (0-5) convert to matlab (1-6)
                    iconValue(jj, iconID, ii) = data(jj, 4);
                elseif slotChoice == 39
                    iconID = data(jj, 3) + 1;
                    iconValue(jj, iconID, ii) = data(jj, 5);
                end

            end
        end
        
    end
end

% for p = 1:length({d.name})
% 
% 
%     meanIconValues(p,1) = mean(iconValue(:,1,p), 'omitnan');
%     meanIconValues(p,2) = mean(iconValue(:,2,p), 'omitnan');
%     meanIconValues(p,3) = mean(iconValue(:,3,p), 'omitnan');
%     meanIconValues(p,4) = mean(iconValue(:,4,p), 'omitnan');
%     %meanIconValues(p,5) = mean(iconValue(:,5,p), 'omitnan');
%     %meanIconValues(p,6) = mean(iconValue(:,6,p), 'omitnan');
%     
% end



   


prePostRatingsMat = [ratingsAvgPreFinal; ratingsAvgPostFinal]

% condsMat = [condOneProportion1v2 condTwoProportion1v2 
%     condOneProportion1v3 condThreeProportion1v3 condTwoProportion2v3 
%     condThreeProportion2v3 condTwoProportion2v4 condFourProportion2v4
%     condThreeProportion3v4 condFourProportion3v4]

