Skip to content

ndi.fun.docTable.element

 ELEMENT Creates a summary table of element documents and their associated metadata.

    elementTable = element(SESSION)

    This function retrieves all 'ndi_element' documents from a session using
    session.getelements(). It then dynamically discovers all metadata document
    types that are associated with elements. For each element, it finds all
    linked metadata documents and aggregates their properties into a single summary
    table.

    Each row in the output table represents a single element. The first few columns
    contain the element's core properties (ID, name, etc.). Subsequent columns are
    dynamically generated based on the metadata found. These columns contain
    comma-separated lists of unique values for each property from the associated
    metadata documents.

    Inputs:
        SESSION - An active and connected ndi.session or ndi.dataset object.

    Outputs:
        elementTable - A MATLAB table where each row is an element. Columns are
                     dynamically generated based on the data found.
                     Core columns include:
                     - 'subject_id': The ID of the subject associated with the element.
                     - 'element_id': The unique identifier for the element.
                     - 'element_name': The name of the element.
                     - 'element_type': The type of the element.
                     - 'element_reference': The reference identifier for the element.
                     Dynamic columns are created for each metadata property found.
                     The naming convention is 'DocumentTypePropertyName', for example:
                     - 'PositionName': From 'position_metadata' documents.
                     - 'ProbeLocationOntology': From 'probe_location' documents.

    See also: ndi.session, ndi.query, ndi.fun.table.vstack, ndi.fun.name2variableName