matrixFromRows

matrixFromRows(...arr)

matrixFromRows(row1, row2)

matrixFromRows(row1, row2, row3)

Try it yourself:

See also:

Build a matrix from rows

matrixFromRows constructs a matrix by treating each supplied vector or array as one row. It is ideal when observations, equations, or records are already written horizontally.

Example

Rows [1,2] and [3,4] form a 2-by-2 matrix. Use matrixFromColumns when your inputs are features stored as columns. transpose exchanges the two viewpoints.

Compatibility

All rows must have the same length for a rectangular matrix. Verify dimensions with size before using multiply or a solver. concat can append compatible row blocks, but matrixFromRows is clearer at construction time.

Try Matrix From Rows in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions