Display random images to appear in GUI
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!