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
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 个评论
Ryan Littlejohn
2019-11-16
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)) = [];
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 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!