MATLAB: How to present images i random order

imagesrandom ordershuffle

Hi,
I have 10 images and want to present it in random order.
Since there are other images in that folder, I want to specify the pictures which are presented, and then want to show it in random sequence.
How to do it?
Appreciate.

Best Answer

files = dir('*.jpg') ; % all jp gimages in folder
N = length(files) ; % total files
idx = randperm(N) ; % random order of numbers till N
for i = 1:N % loop for each file
files(idx(i)).name
end