Function Repository Resource:

AppendColumn

Source Notebook

Append a column to the right of a matrix

Contributed by: Michael Sollami

ResourceFunction["AppendColumn"][matrix,list]

appends a vector list as a column to matrix.

ResourceFunction["AppendColumn"][matrix,s]

appends a constant vector of scalar s to matrix.

ResourceFunction["AppendColumn"][column]

represents an operator form of AppendColumn that can be applied to a matrix.

Details and Options

Dimensions of matrix and list must be compatible.

Examples

Basic Examples (2) 

Append a column vector to a matrix:

In[1]:=
m = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}};
ResourceFunction["AppendColumn"][m, {2, 4, 6}] // MatrixForm
Out[2]=

Append a scalar value to a matrix:

In[3]:=
ResourceFunction["AppendColumn"][m, \[Pi]] // MatrixForm
Out[3]=

Scope (1) 

Use AppendColumn as an operator form:

In[4]:=
m = RandomReal[1, {3, 4}]; 
ResourceFunction["AppendColumn"][{1, 2, 3}]@m // MatrixForm
Out[4]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 23 March 2020

Related Resources

License Information