Experiment with a random presentation of images from a folder
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Clarissa
am 16 Okt. 2022
Kommentiert: Clarissa
am 17 Okt. 2022
Hi everyone, I'm new to matlab. I am trying to create a script for my experiment. The script should consist in the presentation on the screen of 40 images showing emotional faces (with 3 different emotions: neutral, happy, angry) from a folder called "images.experiment". These images must be presented randomly without repeating themselves in a loop which is repeated 3 times. After each image I should make an assessment of the intensity ("how emotional is the stimulus you see?") of the emotion in the image on a Likert scale from 1 to 9. Finally I have to save every answer (according to the condition/image) of each subject on an excel document. Can someone help me? I am using Psychtoolbox on Window. Thanks everyone in advance.
4 Kommentare
Walter Roberson
am 16 Okt. 2022
randperm(40) three times to get the order of presentation. The rest about showing an image at a particular location for a particular time is really psychtoolbox functions not MATLAB. Functions to get input with timing is also psychtoolbox
Akzeptierte Antwort
Walter Roberson
am 16 Okt. 2022
Verschoben: Walter Roberson
am 16 Okt. 2022
http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F shows how you can read a series of files. assign them into a cell array. Then
numfiles = numel(YourCellArray);
order_to_show = [randperm(numfiles), randperm(numfiles), randperm(numfiles)];
Now do whatever psychtoolbox requires you to do in order to set up the screen. Then you would do something similar to
for K = 1 : numel(order_to_show)
this_image = YourCellArray{order_to_show(K)};
do whatever psychtoolbox needs to present the fixation point for the given time
do whatever psychtoolbox needs to present this_image for the given time
do whatever psychtoolbox needs to present the mask for the given time
do whatever psychtoolbox needs to retrieve the user input
responses(K) = user response
end
results = table(order_to_show(:), responses(:), 'VariableNames', {'ImageNumber', 'Response'});
writetable(results, 'FileNameToWriteTo.xlsx');
You might modify the results table slightly if you wanted to write in the image name instead of the image number (index), something like
results = table(ImageNames(order_to_show(:)), responses(:), 'VariableNames', {'ImageName', 'Response'});
3 Kommentare
Walter Roberson
am 16 Okt. 2022
All the details about presenting for a given time or fetching user input, are using Psychtoolbox supplied functions. Psychtoolbox has its own support forum. The details are not really appropriate here since they are third-party functions not supplied as part of Mathworks products.
See https://www.mathworks.com/matlabcentral/answers/143088-real-time-detect-keypress#answer_285124 for information about the input options.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image display and manipulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!