필터 지우기
필터 지우기

How do I generate 1000 random rows from an array only once, so that if I run the program again, it will still be the same set of randomly generated number previously

조회 수: 1 (최근 30일)
% Generate a matrix named foo
foo = randn(10000,2);
% draw 1000 random samples
index = randsample(1:length(foo), 1000);
bar = foo(index,:);
Suppose I have the code above, I only want to generate 1000 random rows once. I do not want a different set of 1000 random row everytime I run the program again. Please help. Thank you
  댓글 수: 1
KSSV
KSSV 2020년 1월 31일
If you use randsample it will generate everytime a random array everytime. If you don't want this, run only once and save it.

댓글을 달려면 로그인하십시오.

채택된 답변

Stephen23
Stephen23 2020년 1월 31일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by