sum first and last number of array

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

Réponses (1)

José-Luis
José-Luis le 5 Mai 2014
Modifié(e) : José-Luis le 5 Mai 2014
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.

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by