I have a folder containing 8 images and I want matlab to choose only one of those images by random to display the picture in the center of the screen. The images are in the folder /congruent and are named for example "1.bmp" or "2.bmp".
I tried the follwing code, but it doesn't work as I don't really know how to access the images in the right way.
Thank you very much in advance!!
if trialcondition == 1
randomnumber = randi([1 8]);
picture = imread(fullfile(pwd,'congruent',randomnumber,'*.bmp'));
elseif trialcondition == 2