MATLAB: Randomly sampling with replacement from a sample.

datasamplesampling with replacement

Hi,
I am simulating traffic data on a highway bridge.
I want to generate 1000 trucks a day for a total of 2500 days and find the max for each day.
This means sampling with replacement 1000 trucks from the 113,000 in the data 2500 times and finding the max each time.
As far as I am aware I cannot change the size of a bootstrap sample so I have being trying to use datasample.
The code I have tried is:
myStatistic=@max
nreps=2500
y=datasample(data,1000);
for i=1:nreps; populationStat(i)=myStatistic(data(;,i));
This does not work. What code or method should I be using.
Thanks in advance

Best Answer

...sampling with replacement 1000 trucks from the 113,000 in the data...
y=truckdata(randi(113000,1000,1));