matlab invert
about your question "Why not y(5,1)=x(1,5)?"
In Matlab y(m,n) means the element in the mth row and nth column.
i.e if you have this script
x=[1 2 3 4 5];
y(5,1)=x(1,5);
will give you a vector of one column and 5 rows
y=[0
0
0
0
5]
and it will assign all the remaining elements to zero as shown above.
I think that you will need a script as the one mentioned by gfloros.
or you can define it exlicitly
y=[5:-1:1] which means the starting element is 5 and the step is -1 till you reach the final element which is 1
Matlab is primarily based on Matrices and vectors, to get more help I think the Matlab getting started tutorial is the best refrence for that topic