subset#
Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation l:u. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.
Available in: math cells, REPL.
Syntax#
value[index]
subset(value, index(...))
subset(value, index(...), replacement)
Arguments and behavior#
Use the callable form shown in the example. Matrix dimensions must agree for matrix operations. Scalar comparison produces a boolean.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
subset([10,20,30],index(2))Interactive examples could not load. You can still copy the expressions.
Expected result: 20.
See also#
concat · det · diag · identity · inv · ones · range · size · squeeze · trace · transpose · zeros