I want to create multiple buffers one after the other. How do ensure that they show in a random order?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ive got this piece of script. The intent is for it to display 2 squares and have a word in the centre. Im hoping to duplicate this many times and changing the word, font and the colours of the 2 cgrects. My question is, how do i randomise the order that theyre shown in once its been duplicated say for example 20 times.
cgloadlib
cgopen(1,0,0,0)
cgscale(30)
cgalign('r','c')
cgpencol(1,0,0)
cgrect(-6,-4,7,7)
cgalign('l','c')
cgpencol(0,0,1)
cgrect(6,-4,7,7)
cgpencol(1,0,0)
cgfont('calibri',4)
cgtext((colorword(:,1)),0,6);
cgflip
wait(5000)
would i have to loop the whole thing and set it up to show randomly? IF SO how do i do this?
0 commentaires
Réponses (1)
dpb
le 10 Déc 2019
Simplest would be to create N objects in (say) a cell array. Then generated a randomized indexing vector as |randperm
idxrand=randperm(N);
and then display objects in that order.
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!