2
$\begingroup$

I want to append $b$ as the last row for the matrix $A$ to form a new matrix $X$. I tried Join[] but it did not do what I wanted. Can someone help?

A = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}}
b = Array[a, 3]
X = Join[ A, b, 1 ] // MatrixForm
$\endgroup$
10
  • 1
    $\begingroup$ b = {Array[a, 3]} $\endgroup$ May 16, 2023 at 18:47
  • $\begingroup$ Thanks. I don't think this is what I want though. $\endgroup$
    – Morcus
    May 16, 2023 at 18:51
  • 3
    $\begingroup$ Do not include the MatrixForm in the definition of X, i.e., (X = Join[A, {b}]) // MatrixForm $\endgroup$
    – Bob Hanlon
    May 16, 2023 at 19:30
  • 1
    $\begingroup$ Catenate[{A, {b}}] // MatrixForm $\endgroup$ May 16, 2023 at 19:36
  • 1
    $\begingroup$ Try: Append[A,b] $\endgroup$ May 16, 2023 at 19:52

1 Answer 1

3
$\begingroup$

try:

Append[A, b] // MatrixForm
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.