How to delete every nth row?
21 views (last 30 days)
Show older comments
I have a given matrix and I would like to delete every nth row. (Is there any particularity I have to keep in mind given that my matrix will generally not be a multiple of n?)
0 Comments
Accepted Answer
the cyclist
on 28 Nov 2016
Edited: the cyclist
on 28 Nov 2016
If your matrix is A, then
A(n:n:end,:) = [];
will delete every nth row. Your matrix row count does not need to be evenly divisible by n.
More Answers (1)
Ramesha Silva
on 24 Apr 2020
How to delete all even columns of A?
0.6000 0.4000 0.6000 0.8000 -1.0000
1.0000 2.0000 3.0000 4.0000 5.0000
0 0 0 0 -1.0000
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices 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!