MATLAB: Random resampling with rebalancement

resampling

I have an array Y (3000*1) from which i want to drow an n=100 random samples with rebalancement(with repeating possible), such that each sample contains 252 consecutive values from Y (i.e only the starting point is randomly chosen) the reslut dimensions are meant to be 252*100
Thank you for helping with this
regards

Best Answer

r = randi(2748,100,1);
x = zeros(252,100);
for k = 1:100
x(:,k) = Y(r(k):r(k) + 251);
end