필터 지우기
필터 지우기

random pair data.

조회 수: 1 (최근 30일)
reez all
reez all 2012년 5월 21일
hi, thank you for helping me from my previous problem. i have other problem related to generate random pair between two array data.
for x = 1:5
y = randi([6,10],1);
fprintf('%d -> %d\n',x,y);
end
My problem is, the not all y data are used. i want all both x and y data is used. thank you for your help.

채택된 답변

per isakson
per isakson 2012년 5월 21일
"not all y are use". My guess is that you want something like:
y = 5 + randperm( 5, 5 );
for x = 1:5
fprintf('%d -> %d\n', x, y(x) );
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by