How can I randomize the order of a matrix of images

조회 수: 1 (최근 30일)
Beyza Kural
Beyza Kural 2020년 8월 2일
댓글: Beyza Kural 2020년 8월 2일
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
dpb
dpb 2020년 8월 2일
What code did you use?
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
madhan ravi
madhan ravi 2020년 8월 2일
Thank you sir Image Analyst!
Beyza Kural
Beyza Kural 2020년 8월 2일
thank you this helps.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by