MATLAB Answers

Deleting every n rows in matrix

20 views (last 30 days)
Niet hier
Niet hier on 13 Apr 2021 at 14:33
Commented: Niet hier on 14 Apr 2021 at 11:29
I have a matrix of m x n
I want to keep the first row and then delete 14 rows and then preserve the 16th row, then delete the next 14 rows and preserve the 31th row.
What is the best way to do this?

Accepted Answer

David Hill
David Hill on 13 Apr 2021 at 14:38
Edited: David Hill on 13 Apr 2021 at 14:39
newMatrix=oldMatrix(1:15:end,:);

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 13 Apr 2021 at 14:36
A=1:100
A=A(1:15:end)

Community Treasure Hunt

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

Start Hunting!

Translated by