MATLAB: I want the code to randomize the rows and present each row for 10 times

for loopshuffle

I want the code to randomize the rows and present the stimulus by taking the each row values for 10 times. Here is the code that I have written.
Decentration = [0, 0.5; 0, 0; 0, -0.5; -0.5,0; 0.5, 0];
trial = 10;
for i = 1:trial;
for iter= 1:length(Decentration);
Decentration = Shuffle(Decentration, 2);
XDecentration = Decentration(:,1);
YDecentration = Decentration(:,2);
this presents the stimulus for 50 times but in a different proportion.
Please suggest a code for presenting each row of Decentation to be selected 10 times.

Best Answer

Decentration = [0, 0.5; 0, 0; 0, -0.5; -0.5,0; 0.5, 0];
trial = 10;
n = size(Decentration, 1);
idx = repmat(1:n, 1, trial);
order = randperm(size(idx,2));
randrows = Decentration(order,:);
XDecentration = randrows(:,1);
YDecentration = randrows(:2);
This code will present each row exactly trial times, but not in groups. For example, the second row might happen to occur twice in the first 10 stimuli. Or occur 10 times even (though that is not likely)
This is not the code to present each stimuli exactly once per trial: it is code that preserves the correct portions of entries over the entire experiment but not in the short term.