How do I remove 9 random numbers from a shuffled array?

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

답변 (3개)

KALYAN ACHARJYA
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

thanks, i made an error in my question, to correct myself and to clarify i wanted to just remove 9 values from my shuffled array they don't have to be randomized because theyre already shuffled.
shuffle_data(1:9)=[]
or
shuffle_data(randi(27):randi(27)+9)=[]
or
shuffle_data(end-9:end)=[]

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

Walter Roberson
Walter Roberson 2019년 11월 16일
shuffled_data(ismember(shuffled_data, values_to_ignore)) = [];
Image Analyst
Image Analyst 2019년 11월 16일

0 개 추천

Since they’re already shuffled simply do vec = vec(10:end) % Remove 9 values

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2019년 11월 16일

답변:

2019년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by