randomly selecting and deleting rows from a matrix
Afficher commentaires plus anciens
b = X; %X is a 600 by 40 matrix
xnew = b(randperm(427),:);
i want to determine the 173 rows in b that were not selected i could also delete the selected 427 rows from b to obtain the remaining unselected rows can anyone help me do this?
your help is much appreciated
Réponse acceptée
Plus de réponses (1)
Yushuo
le 6 Juil 2022
I just used if the code line number divide by 2 reminder is 0 then delete it
A=[0.5666 0.3169 ; 0.5181 0.3317 ; 0.6645 0.0650 ; 0.0188 0.5120 ; 0.8007 0.4257 ];
disp (A);
for oooo=1:size(A,1)
if rem(oooo , 2)==0
A(oooo,:)=[];
end
end
disp (A);
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!