Selecting Every Other Element in a Matrix
Afficher commentaires plus anciens
How can I select every other element in a matrix, such as A=[1 2 8 7 6 5 4 6]?
Réponse acceptée
Plus de réponses (1)
prashanth GT
le 2 Mar 2020
0 votes
function y = everyOther(x)
y = x(1:2:length(x));
end
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!