Skip to content

ndi.fun.table.identifyValidRows

 IDENTIFYVALIDROWS Identifies valid rows in a MATLAB table based on specified criteria.

    validInd = IDENTIFYVALIDROWS(variableTable)
    Checks no specific variables by default. All rows are considered valid unless
    checkVariables and invalidValues are provided. This usage returns all true.

    validInd = IDENTIFYVALIDROWS(variableTable, checkVariables)
    Checks the variables specified in 'checkVariables' for NaN values.
    Rows where any of the specified variables contain NaN are marked as invalid.

    validInd = IDENTIFYVALIDROWS(variableTable, checkVariables, invalidValues)
    Checks the variables in 'checkVariables' against corresponding 'invalidValues'.

    INPUT ARGUMENTS:
        variableTable: A MATLAB table. Rows typically correspond to observations
                       and columns to variables.

        checkVariables: (Optional) Names of variables within 'variableTable' to be checked.
                       Can be a character vector, a string scalar, a string array,
                       or a cell array of character vectors/strings.
                       Default: {} (empty cell array). If empty, and 'invalidValues'
                       is also empty or not provided, all rows are marked valid.

        invalidValues: (Optional) Specifies the values to be considered invalid for
                       the corresponding variables in 'checkVariables'.
                       - If not provided or empty (and 'checkVariables' is provided):
                         Defaults to checking for NaN in each 'checkVariables'.
                       - If a single scalar value (numeric, char, string, logical):
                         This value is treated as the invalid marker for ALL variables
                         listed in 'checkVariables'.
                       - If a cell array: Must contain the same number of elements as
                         'checkVariables'. Each cell 'invalidValues{j}' specifies the
                         invalid value for the variable 'checkVariables{j}'.
                         Elements can be numeric (including NaN), char, string, or logical.

    OUTPUT ARGUMENTS:
        validInd: A logical column vector with the same number of rows as
                  'variableTable'. 'true' indicates a valid row, 'false'
                  indicates an invalid row.