sum first and last number of array
Mostrar comentarios más antiguos
hi, if i had an array of 20 numbers, what code should i use to sum the first and the last, the second and the second to last, etc.
thanks in advance
Respuestas (1)
To give you a hint:
a = randi(10,10,1);
your_mat = sum([a flipud(a)],2);
Modify to fit your criteria.
Please accept an answer if it helped you.
Categorías
Más información sobre Matrix Indexing 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!