%%
% let's look at raw data
load('data raw.mat'); % load data in workspace
data(8) = [];  % this participant is a dud, unfortunately, and needs to be removed
num_parts = max(size(data)); % how many participants?


% plot data for a particular trial, for illustration
% let us plot the raw data for the left pupil on the last (hard) problem
figure; % open a figure
foo = max(size(data(1).trial_data(6).LPupil)); % how many samples?
scatter(1:600,data(1).trial_data(6).LPupil(foo-599:foo),4,'k','filled') % plot the last 600 (or 10s given 60Hz sampling)
title('Hard problem 3','FontSize',16); % title
set(gca,'XTick',0:120:600, 'XTickLabel', 0:2000:10000); % ticks along x axis
hold on; % we will add to plot, rather than replace with new data
for j = 2:num_parts % repeat for remaining participants
    foo = max(size(data(j).trial_data(6).LPupil)); % how many samples
    scatter(1:600,data(j).trial_data(6).LPupil(foo-599:foo),4,'k','filled') % plot last 600
end
hold off; % done adding data
xlim([1 600]); % set axis limits
ylim([0 5]); % axis limits
xlabel('Time after problem onset (ms)','FontSize',16); % axis label
ylabel('Pupil diameter (mm)','FontSize',16); % axis label
set(gca, 'FontSize',14); % axis label
