Just keep it simple:
>> a = 1:5;
>> M = diag(ones(1,numel(a)-1),1);
>> M(end,:) = a
M =
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 2 3 4 5
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!