# I want to do bootstrap analysis by using 20*1 matrix.

2 views (last 30 days)
Chris on 26 Oct 2022
Answered: the cyclist on 27 Oct 2022
I want to draw 500 samples from the 20*1 matrix (20 pairs of observations).
In this case, what codes do I have to use?
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

the cyclist on 27 Oct 2022
One way is
% Pretend input data
M = rand(20,1);
idx = randi(20,500,1);
samples = M(idx);
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### More Answers (1)

the cyclist on 27 Oct 2022
If you have the Statistics and Machine Learning Toolbox, you can do
% Pretend input data
M = rand(20,1);
samples = randsample(M,500,true);
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Descriptive Statistics and Visualization in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!