Creating new matrix from a preexisting matrix

Could you please help me to sort out this.
Let's say I have a mtarix A as given below.
A = [308 404 555 1071 1246]
How can I create a new matrix B from A with exceeding element, such that?
B = [1 308
309 404
405 555
556 1071
1072 1246] %and so on

 Accepted Answer

A = [308 404 555 1071 1246].'
A = 5×1
308 404 555 1071 1246
B=[[1;A(1:end-1)+1] A]
B = 5×2
1 308 309 404 405 555 556 1071 1072 1246

More Answers (0)

Products

Asked:

on 17 Aug 2021

Commented:

on 17 Aug 2021

Community Treasure Hunt

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

Start Hunting!