How can I randomize the order of a matrix of images

1 vue (au cours des 30 derniers jours)
Beyza Kural
Beyza Kural le 2 Août 2020
Commenté : Beyza Kural le 2 Août 2020
I have a 2x2 matrix (four images total, same size) that I need to randomize each time the code is ran. I tried using randperm but I can't seem to get the randomized numbers (1-4) to be indexed to the image file names.
  2 commentaires
dpb
dpb le 2 Août 2020
What code did you use?
Beyza Kural
Beyza Kural le 2 Août 2020
IMAGESTORE = {queen,stark,hound,imp} %names of the images (queen,stark,hound,imp)
col= size(IMAGESTORE,2)
random = randperm(col)
new = IMAGESTORE(:,random)
the variable new gives me the dimensions on the images, not the actual images.

Connectez-vous pour commenter.

Réponses (1)

madhan ravi
madhan ravi le 2 Août 2020
Modifié(e) : madhan ravi le 2 Août 2020
Filenames = compose('image%d.png', 1:4);
Filenames(randperm(numel(Filenames))) % ?
  7 commentaires
madhan ravi
madhan ravi le 2 Août 2020
Thank you sir Image Analyst!
Beyza Kural
Beyza Kural le 2 Août 2020
thank you this helps.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by