How do I remove 9 random numbers from a shuffled array?
Mostrar comentarios más antiguos
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
Respuestas (3)
KALYAN ACHARJYA
el 16 de Nov. de 2019
Editada: KALYAN ACHARJYA
el 16 de Nov. de 2019
"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 comentarios
Ryan Littlejohn
el 16 de Nov. de 2019
KALYAN ACHARJYA
el 16 de Nov. de 2019
shuffle_data(1:9)=[]
or
shuffle_data(randi(27):randi(27)+9)=[]
or
shuffle_data(end-9:end)=[]
Walter Roberson
el 16 de Nov. de 2019
shuffled_data(ismember(shuffled_data, values_to_ignore)) = [];
Image Analyst
el 16 de Nov. de 2019
0 votos
Since they’re already shuffled simply do vec = vec(10:end) % Remove 9 values
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!