I have a 15x7
matrix of doubles called A
. What I want to do it to add one extra row and column as a title name for the rows and column which will be saved as matrix B
which will be of size 16x8
.
A=
1 1 -27.84543037 235.8829193 1529.838379 309.5192566 151.2160492
1 1 -25.76914215 22.570755 1521.290161 310.2462463 231.4568634
1 1 -162.0449066 19.34294128 1515.019287 258.4113464 232.6483002
1 1 -316.8930359 -106.8941193 1407.015625 190.3127441 283.7460022
1 1 -300.2756958 139.7964783 1365.73584 193.3990479 181.0596008
1 1 110.5066299 25.79856873 1527.561035 361.6555786 230.2752075
1 1 296.7176208 -125.0899811 1428.061768 439.6409607 290.4381409
1 1 281.2500305 118.227478 1377.988037 437.5250854 190.5966339
1 1 -21.2894783 -170.6610107 1523.40271 311.9530029 304.5064392
1 1 -105.9274673 -366.0036011 1521.414429 279.9092102 378.5228271
1 1 -178.0385742 -654.3458252 1275.617554 239.6331177 535.3726807
1 1 -247.3761902 -931.5979614 1039.274658 182.9398804 756.1568604
1 1 72.30783844 -361.7819214 1529.616089 347.2199097 376.1908569
1 0.5 137.2854919 -687.1557617 1330.945068 379.3947449 537.2888184
1 0.5 206.1542358 -984.8857422 1119.07019 426.0763245 746.7713623
B=
AA BB CC DD EE FF GG
EE 1 1 -27.84543037 235.8829193 1529.838379 309.5192566 151.2160492
FF 1 1 -25.76914215 22.570755 1521.290161 310.2462463 231.4568634
GG 1 1 -162.0449066 19.34294128 1515.019287 258.4113464 232.6483002
HH 1 1 -316.8930359 -106.8941193 1407.015625 190.3127441 283.7460022
II 1 1 -300.2756958 139.7964783 1365.73584 193.3990479 181.0596008
JJ 1 1 110.5066299 25.79856873 1527.561035 361.6555786 230.2752075
KK 1 1 296.7176208 -125.0899811 1428.061768 439.6409607 290.4381409
LL 1 1 281.2500305 118.227478 1377.988037 437.5250854 190.5966339
MM 1 1 -21.2894783 -170.6610107 1523.40271 311.9530029 304.5064392
NN 1 1 -105.9274673 -366.0036011 1521.414429 279.9092102 378.5228271
OO 1 1 -178.0385742 -654.3458252 1275.617554 239.6331177 535.3726807
PP 1 1 -247.3761902 -931.5979614 1039.274658 182.9398804 756.1568604
QQ 1 1 72.30783844 -361.7819214 1529.616089 347.2199097 376.1908569
RR 1 0.5 137.2854919 -687.1557617 1330.945068 379.3947449 537.2888184
SS 1 0.5 206.1542358 -984.8857422 1119.07019 426.0763245 746.7713623
I've tried saving the new column in a vector as newcol=['AA','BB','CC,'DD','EE','FF','GG']
and then add it to A
like B=[newcol;A];
and then do the same with rows. But it is not working, so if anyone could please advise how can I do this.