Borrar filtros
Borrar filtros

How to present images i random order?

2 visualizaciones (últimos 30 días)
M Min
M Min el 3 de Abr. de 2017
Comentada: M Min el 3 de Abr. de 2017
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.

Respuesta aceptada

KSSV
KSSV el 3 de Abr. de 2017
Editada: KSSV el 3 de Abr. de 2017
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
  4 comentarios
dbmn
dbmn el 3 de Abr. de 2017
And if you want a random but repeatable sequence you could set the seed for the random number generation before KSSVs script using
rng(1);
This way the sequence is random but you can always reconstruct the exact same sequence using the same seed (in our case 1).
M Min
M Min el 3 de Abr. de 2017
Thanks a lot!!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by