function b = bootstrap(x,stat,nboot); % usage b = bootstrap(x,stat,nboot) % x = original data matrix % stat = stat function ('mean') % nboot = number of bootstrap resamples n = size(x,1); for i=1:nboot xs = x(resample(n),:); b(i,:) = feval(stat,xs); end