Skip to content

MATRIX_2_VECTOR

Download Flojoy Studio to try this app
Convert a Matrix DataContainer to a Vector DataContainer. Params: default : Matrix The input matrix that will be transformed into vector data type. Returns: out : Vector Vector that is flatten from input matrix.
Python Code
from flojoy import flojoy, Vector, Matrix


@flojoy
def MATRIX_2_VECTOR(default: Matrix) -> Vector:
    """Convert a Matrix DataContainer to a Vector DataContainer.

    Parameters
    ----------
    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 App

Having problems 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.