randomly selecting and deleting rows from a matrix
Show older comments
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
Accepted Answer
More Answers (1)
Yushuo
on 6 Jul 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);
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!