Selecting Every Other Element in a Matrix
Mostrar comentarios más antiguos
How can I select every other element in a matrix, such as A=[1 2 8 7 6 5 4 6]?
Respuesta aceptada
Más respuestas (1)
prashanth GT
el 2 de Mzo. de 2020
0 votos
function y = everyOther(x)
y = x(1:2:length(x));
end
Categorías
Más información sobre Operating on Diagonal Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!