Outputting numbers not selected in using "randperm" command
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Abhishek Baba
le 15 Mar 2020
Commenté : Abhishek Baba
le 15 Mar 2020
I have a row which contains 93 numbers ranging from 1 to 116. The numbers in the rows are randomly selected using "randperm" command. Now, I want to output the numbers that are not selected. How do we do that?
0 commentaires
Réponse acceptée
Walter Roberson
le 15 Mar 2020
Select_How_Many = 42;
Num_in_Row = length(row);
selection_index = randperm(Num_in_Row, Select_How_Many);
unselection_index = setdiff(1:Num_in_Row, selection_index);
selected_values = row(selection_index);
unselected_values = row(unselection_index);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!