Hey @Ivana Smith, You can achieve this by creating a table in MATLAB to store the responses for each image. Each row of the table will correspond to an image, and each column will represent a different respondent's answer, you can simulate collecting responses by manually populating the table or by creating a function that prompts for input.
Note: I have used bar plot instead of scatter plot as i find bar plot to be more appropriate, you can change it based on your requirement
I have created the dummy data below:
% Number of images and respondents
numImages = 5;
numRespondents = 3; % You can adjust this based on your needs
% Initialize an empty cell array
responses = cell(numImages, numRespondents);
% Create a table with appropriate row and column names
imageNames = arrayfun(@(x) sprintf('image_%d.png', x), 1:numImages, 'UniformOutput', false);
respondentNames = arrayfun(@(x) sprintf('Respondent_%d', x), 1:numRespondents, 'UniformOutput', false);
% Create the table
responseTable = array2table(responses, 'RowNames', imageNames, 'VariableNames', respondentNames);
% Simulate collecting responses
responseTable{1, 1} = {'A'};
responseTable{2, 1} = {'B'};
responseTable{3, 1} = {'A'};
responseTable{4, 1} = {'B'};
responseTable{5, 1} = {'A'};
responseTable{1, 2} = {'B'};
responseTable{2, 2} = {'A'};
responseTable{3, 2} = {'B'};
responseTable{4, 2} = {'A'};
responseTable{5, 2} = {'B'};
responseTable{1, 3} = {'A'};
responseTable{2, 3} = {'B'};
responseTable{3, 3} = {'A'};
responseTable{4, 3} = {'B'};
responseTable{5, 3} = {'A'};
To transform the responses into a format suitable for a scatter plot, you need to convert the categorical responses ('A' and 'B') into numerical values.
% Convert responses to numerical values
countA = sum(strcmp(responseTable{:,:}, 'A'), 2);
countB = sum(strcmp(responseTable{:,:}, 'B'), 2);
% Create a bar plot
figure;
bar(1:numImages, [countA, countB], 'stacked');
xlabel('Image Number');
ylabel('Number of Responses');
title('Responses per Image');
legend({'A', 'B'});
xticks(1:numImages);
xticklabels(imageNames);
grid on;