How can I randomize the order of a matrix of images

3 次查看(过去 30 天)
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 个评论
Beyza Kural
Beyza Kural 2020-8-2
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.

请先登录,再进行评论。

回答(1 个)

madhan ravi
madhan ravi 2020-8-2
编辑:madhan ravi 2020-8-2
Filenames = compose('image%d.png', 1:4);
Filenames(randperm(numel(Filenames))) % ?
  7 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by