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

Answers (1)

José-Luis
José-Luis on 5 May 2014
Edited: José-Luis on 5 May 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.

Asked:

on 5 May 2014

Edited:

on 5 May 2014

Community Treasure Hunt

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

Start Hunting!