Skip to content

MATRIX_2_VECTOR

The MATRIX_2_VECTOR node takes a matrix and flatten it into vector type data.Inputs ------ default: Matrix The input matrix that will be transformed into vector data type.Params:Returns:out : VectorVector that is flatten from input matrix.
Python Code
from flojoy import flojoy, Vector, Matrix


@flojoy
def MATRIX_2_VECTOR(default: Matrix) -> Vector:
    """The MATRIX_2_VECTOR node takes a matrix and flatten it into vector type data.

    Inputs
    ------
    default: Matrix
        The input matrix that will be transformed into vector data type.

    Returns
    -------
    Vector
        Vector that is flatten from input matrix.
    """
    rVector = default.m.flatten()

    return Vector(v=rVector)

Find this Flojoy Block on GitHub

Example

Having problem with this example app? Join our Discord community and we will help you out!
React Flow mini map

This example shows the function of the MATRIX_2_VECTOR node. This node simply changes the data container type from Matrix to Vector.