Display random images to appear in GUI

9 vues (au cours des 30 derniers jours)
Suphaveer Keeratireungrit
Suphaveer Keeratireungrit le 14 Déc 2018
Commenté : Mark Sherstan le 14 Déc 2018
Hi, Im really new to MATLAB and Im trying to create a Ring of Fire game on Matlab using GUI where once I press start random cards will appear. I have all the images in one folder and im wondering how I could dispaly random images from the folder?

Réponse acceptée

Mark Sherstan
Mark Sherstan le 14 Déc 2018
Try this:
imgFolder = fullfile('images');
imgs = imageDatastore(imgFolder);
numOfImgs = length(imgs.Files);
for j = 1:10
ii = randi([1 numOfImgs]);
imshow(imread(imgs.Files{ii}))
end
  2 commentaires
Suphaveer Keeratireungrit
Suphaveer Keeratireungrit le 14 Déc 2018
Thank you very much! Really appreciate it!!
Mark Sherstan
Mark Sherstan le 14 Déc 2018
No problem, good luck with your project.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by