How to change the rng value

조회 수: 1 (최근 30일)
Prabha Kumaresan
Prabha Kumaresan 2018년 3월 21일
댓글: Walter Roberson 2018년 5월 7일
code:
unused_rows=1:6
while ~isempty(unused_rows)
N_UE_rows=2;
rng(3)
rows=unused_rows(randsample(length(unused_rows),N_UE_rows))
[~,idx]=find(ismember(unused_rows,rows))
unused_rows(idx)=[]
end
The above code works how to run the code by having different numbers of rng say for example rng(12),rng(2),rng(1).
  댓글 수: 1
Steven Lord
Steven Lord 2018년 5월 1일
Prabha, you've asked this same question or a slight variation several times now. It's still not clear to me exactly what you're trying to do. Please take a short break from coding and write out IN WORDS NOT CODE a description of what you're trying to do. Explain it as though you were explaining it to someone who has no idea what problem you're trying to solve. That may help us understand your ultimate goal and allow us to suggest more effective solutions to that problem.

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 3월 21일
list_of_rng_seeds = [12, 2, 1];
rng_usage_idx = 0;
unused_rows = 1:6;
while ~isempty(unused_rows)
N_UE_rows = 2;
rng_usage_idx = mod(rng_usage_idx, length(list_of_rng_seeds)) + 1;
rng(rng_usage_idx);
rows=unused_rows(randsample(length(unused_rows),N_UE_rows))
[~,idx]=find(ismember(unused_rows,rows))
unused_rows(idx)=[]
end
  댓글 수: 28
Prabha Kumaresan
Prabha Kumaresan 2018년 5월 7일
yes the flow chart.
Walter Roberson
Walter Roberson 2018년 5월 7일
Flow charts are usually fairly straight forward to write once you have the code. I find reference to a commercial tool http://www.aivosto.com/visustin.html which can generate flow charts from MATLAB. See also https://stackoverflow.com/questions/5518200/automatically-generating-a-diagram-of-function-calls-in-matlab

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Repeated Measures and MANOVA에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by