Select only determined rows in a matrix
Show older comments
I have a matrix composed of 200 rows and I want to copy in another matrix one every 10 rows obtaining a final matrix of 20 rows...is there a smart way to do it or do I have to use a for loop to index the orws I want to copy?
Accepted Answer
More Answers (1)
Something like this. You'll have to adjust the starting index as needed:
A = repmat((1:100).',[1 4]) % smaller example (100x4)
B = A(10:10:end,:)
1 Comment
Emilio Pulli
on 28 Nov 2021
Categories
Find more on Resizing and Reshaping 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!