I want to create multiple buffers one after the other. How do ensure that they show in a random order?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
dpb
am 10 Dez. 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.
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!