Selecting Every Other Element in a Matrix
Show older comments
How can I select every other element in a matrix, such as A=[1 2 8 7 6 5 4 6]?
Accepted Answer
More Answers (1)
prashanth GT
on 2 Mar 2020
0 votes
function y = everyOther(x)
y = x(1:2:length(x));
end
Categories
Find more on Operating on Diagonal 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!