Array slicing scattered rows

3 views (last 30 days)
AMIT PAWAR
AMIT PAWAR on 26 Apr 2020
Answered: Ameer Hamza on 26 Apr 2020
How can I select scattered rows from an array? Suppose
A = rand(6,6)
now how can I select everything except the second and fifth row of A?

Accepted Answer

Ameer Hamza
Ameer Hamza on 26 Apr 2020
You can use setdiff()
A = rand(6,6);
idx = setdiff(1:size(A,1), [2 5]);
B = A(idx, :);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!