out =
restrict (obj, expr)
¶out =
restrict (obj, ix)
¶Subset rows using variable expression or index.
Subsets a table row-wise, using either an index vector or an expression involving obj’s variables.
If the argument is a numeric or logical vector, it is interpreted as an index into the rows of this. (Just as with ‘subsetrows (this, index)‘.)
If the argument is a char, then it is evaulated as an M-code expression,
with all of this’ variables available as workspace variables, as with
tblish.evalWithTableVars
. The output of expr must be a numeric or logical index
vector (This form is a shorthand for
out = subsetrows (this, tblish.evalWithTableVars (this, expr))
.)
TODO: Decide whether to name this to "where" to be more like SQL instead of relational algebra.
Examples:
[s,p,sp] = tblish.examples.SpDb; prettyprint (restrict (p, 'Weight >= 14 & strcmp(Color, "Red")'))
This is a Tablicious/Octave extension, not defined in the Matlab table interface.
See also: tblish.evalWithTableVars