How do I remove 9 random numbers from a shuffled array?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, i have an array of numbers from 3 to 35 and i have a function created to shuffle these numbers. Right now my program takes the numbers from 3:35 and shuffles them. My question is how do i remove 9 random numbers from this array of shuffled numbers. Thanks
댓글 수: 0
답변 (3개)
KALYAN ACHARJYA
2019년 11월 16일
편집: KALYAN ACHARJYA
2019년 11월 16일
"My question is how do i remove 9 random numbers from this array of shuffled numbers"
shuffled_data=randi(35,[1 35]); % Just Example
shuffle_data(randi(length(shuffle_data),[1 9]))=[]
댓글 수: 2
KALYAN ACHARJYA
2019년 11월 16일
shuffle_data(1:9)=[]
or
shuffle_data(randi(27):randi(27)+9)=[]
or
shuffle_data(end-9:end)=[]
Walter Roberson
2019년 11월 16일
shuffled_data(ismember(shuffled_data, values_to_ignore)) = [];
댓글 수: 0
Image Analyst
2019년 11월 16일
Since they’re already shuffled simply do vec = vec(10:end) % Remove 9 values
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!